Skip to content

Commit 2d0429d

Browse files
authored
build: Stop build and release Workflows in forks (#39)
1 parent 1e0cffe commit 2d0429d

2 files changed

Lines changed: 28 additions & 38 deletions

File tree

.github/workflows/build.yml

Lines changed: 18 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: Build
22
on:
33
workflow_dispatch:
44
schedule:
5-
- cron: '0 0 * * *'
5+
- cron: "0 0 * * *"
66

77
concurrency:
88
group: build
@@ -11,14 +11,14 @@ concurrency:
1111
jobs:
1212
build:
1313
name: Build
14+
if: ${{ github.repository == 'dockur/tor' }}
1415
runs-on: ubuntu-latest
1516
permissions:
1617
actions: write
1718
packages: write
1819
contents: read
1920
steps:
20-
-
21-
name: Get remote package data
21+
- name: Get remote package data
2222
run: |
2323
set -e -o pipefail
2424
latest_tag=$(curl -sSf https://dl-cdn.alpinelinux.org/edge/community/aarch64/APKINDEX.tar.gz |
@@ -37,26 +37,22 @@ jobs:
3737
echo "latest_version=${latest_tag%-*}" >> $GITHUB_ENV
3838
echo "latest_minor=$major.$minor.$patch" >> $GITHUB_ENV
3939
echo "latest_major=$major.$minor" >> $GITHUB_ENV
40-
-
41-
name: Check if the tag exists locally
40+
- name: Check if the tag exists locally
4241
uses: action-pack/tag-exists@v1
4342
id: checkTag
44-
with:
45-
tag: 'v${{ env.latest_tag }}'
46-
-
47-
name: Finish when found
43+
with:
44+
tag: "v${{ env.latest_tag }}"
45+
- name: Finish when found
4846
run: |
4947
#!/bin/bash
5048
val="${{ steps.checkTag.outputs.exists }}"
5149
echo "exists=${val}" >> $GITHUB_ENV
52-
-
53-
name: Checkout
50+
- name: Checkout
5451
if: env.exists == 'false'
5552
uses: actions/checkout@v7
5653
with:
5754
fetch-depth: 0
58-
-
59-
name: Docker metadata
55+
- name: Docker metadata
6056
id: meta
6157
if: env.exists == 'false'
6258
uses: docker/metadata-action@v6
@@ -74,27 +70,23 @@ jobs:
7470
org.opencontainers.image.title=${{ vars.NAME }}
7571
env:
7672
DOCKER_METADATA_ANNOTATIONS_LEVELS: manifest,index
77-
-
78-
name: Set up Docker Buildx
73+
- name: Set up Docker Buildx
7974
if: env.exists == 'false'
8075
uses: docker/setup-buildx-action@v4
81-
-
82-
name: Login into Docker Hub
76+
- name: Login into Docker Hub
8377
if: env.exists == 'false'
8478
uses: docker/login-action@v4
8579
with:
8680
username: ${{ secrets.DOCKERHUB_USERNAME }}
8781
password: ${{ secrets.DOCKERHUB_TOKEN }}
88-
-
89-
name: Login to GitHub Container Registry
82+
- name: Login to GitHub Container Registry
9083
if: env.exists == 'false'
9184
uses: docker/login-action@v4
9285
with:
9386
registry: ghcr.io
9487
username: ${{ github.actor }}
9588
password: ${{ secrets.GITHUB_TOKEN }}
96-
-
97-
name: Build Docker image
89+
- name: Build Docker image
9890
if: env.exists == 'false'
9991
uses: docker/build-push-action@v7
10092
with:
@@ -107,16 +99,14 @@ jobs:
10799
annotations: ${{ steps.meta.outputs.annotations }}
108100
build-args: |
109101
VERSION_ARG=${{ env.latest_version }}
110-
-
111-
name: Create a release
102+
- name: Create a release
112103
if: env.exists == 'false'
113104
uses: action-pack/github-release@v2
114105
with:
115106
tag: "v${{ env.latest_tag }}"
116107
title: "v${{ env.latest_version }}"
117108
token: ${{ secrets.REPO_ACCESS_TOKEN }}
118-
-
119-
name: Send mail
109+
- name: Send mail
120110
if: env.exists == 'false'
121111
uses: action-pack/send-mail@v1
122112
with:
@@ -125,6 +115,6 @@ jobs:
125115
connection_url: ${{secrets.MAIL_CONNECTION}}
126116
subject: Build of ${{ github.event.repository.name }} v${{ env.latest_tag }} completed
127117
body: |
128-
The build job of ${{ github.event.repository.name }} v${{ env.latest_tag }} was completed successfully!
129-
130-
See https://github.com/${{ github.repository }}/actions for more information.
118+
The build job of ${{ github.event.repository.name }} v${{ env.latest_tag }} was completed successfully!
119+
120+
See https://github.com/${{ github.repository }}/actions for more information.

.github/workflows/hub.yml

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,15 @@ on:
99

1010
jobs:
1111
dockerHubDescription:
12+
if: ${{ github.repository == 'dockur/tor' }}
1213
runs-on: ubuntu-latest
1314
steps:
14-
- uses: actions/checkout@v7
15-
-
16-
name: Docker Hub Description
17-
uses: peter-evans/dockerhub-description@v5
18-
with:
19-
username: ${{ secrets.DOCKERHUB_USERNAME }}
20-
password: ${{ secrets.DOCKERHUB_TOKEN }}
21-
repository: ${{ secrets.DOCKERHUB_REPO }}
22-
short-description: ${{ github.event.repository.description }}
23-
readme-filepath: ./readme.md
15+
- uses: actions/checkout@v7
16+
- name: Docker Hub Description
17+
uses: peter-evans/dockerhub-description@v5
18+
with:
19+
username: ${{ secrets.DOCKERHUB_USERNAME }}
20+
password: ${{ secrets.DOCKERHUB_TOKEN }}
21+
repository: ${{ secrets.DOCKERHUB_REPO }}
22+
short-description: ${{ github.event.repository.description }}
23+
readme-filepath: ./readme.md

0 commit comments

Comments
 (0)