Skip to content

Commit 7d18be9

Browse files
committed
Use Env Vars to build and push Docker Images, bump golangci-lint to v1.50.1
1 parent 8e761bc commit 7d18be9

File tree

3 files changed

+15
-7
lines changed

3 files changed

+15
-7
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ jobs:
5353
- uses: actions/checkout@v3
5454
- uses: golangci/golangci-lint-action@v3
5555
with:
56-
version: v1.43.0
56+
version: v1.50.1
5757

5858
- name: Go mod
5959
env:

.github/workflows/release.yml

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,20 +31,28 @@ jobs:
3131
username: ${{ github.repository_owner }}
3232
password: ${{ secrets.GITHUB_TOKEN }}
3333

34+
- name: Prepare Env Vars
35+
run: |
36+
echo GHCR_USER=$(echo ${{ github.repository_owner }} | tr '[:upper:]' '[:lower:]') >> $GITHUB_ENV
37+
3438
# Publish a new release from git tag.
3539
- uses: goreleaser/[email protected]
3640
if: startsWith(github.ref, 'refs/tags/')
3741
with:
3842
version: latest
3943
args: release --rm-dist
4044
env:
45+
DOCKERHUB_USER: ${{ secrets.DOCKER_LOGIN }}
46+
GHCR_USER: ${{ env.GHCR_USER }}
4147
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
4248

4349
# Publish nightly build.
4450
- uses: goreleaser/[email protected]
45-
if: github.event_name == 'schedule'
51+
if: ${{ github.repository_owner == 'mxpv' && github.event_name == 'schedule' }}
4652
with:
4753
version: latest
4854
args: release --rm-dist --nightly
4955
env:
56+
DOCKERHUB_USER: ${{ secrets.DOCKER_LOGIN }}
57+
GHCR_USER: ${{ env.GHCR_USER }}
5058
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.goreleaser.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,11 @@ builds:
2121

2222
dockers:
2323
- image_templates:
24-
- 'mxpv/podsync:{{ .Tag }}'
25-
- 'mxpv/podsync:v{{ .Major }}.{{ .Minor }}'
26-
- 'mxpv/podsync:latest'
27-
- 'ghcr.io/mxpv/podsync:{{ .Tag }}'
28-
- 'ghcr.io/mxpv/podsync:latest'
24+
- "{{ .Env.DOCKERHUB_USER }}/podsync:{{ .Tag }}"
25+
- "{{ .Env.DOCKERHUB_USER }}/podsync:v{{ .Major }}.{{ .Minor }}"
26+
- "{{ .Env.DOCKERHUB_USER }}/podsync:latest"
27+
- "ghcr.io/{{ .Env.GHCR_USER }}/podsync:{{ .Tag }}"
28+
- "ghcr.io/{{ .Env.GHCR_USER }}/podsync:latest"
2929

3030
archives:
3131
- replacements:

0 commit comments

Comments
 (0)