Skip to content

Commit 947ac53

Browse files
committed
Rework release
1 parent 5c29072 commit 947ac53

File tree

2 files changed

+31
-31
lines changed

2 files changed

+31
-31
lines changed

.github/workflows/release.yml

Lines changed: 31 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -9,37 +9,45 @@ jobs:
99
publish:
1010
name: Publish
1111
runs-on: ubuntu-latest
12-
timeout-minutes: 10
12+
timeout-minutes: 20
13+
14+
permissions:
15+
contents: write
16+
packages: write
1317

1418
steps:
15-
- uses: actions/checkout@v3
19+
- name: 📦 Checkout repository
20+
uses: actions/checkout@v3
1621
with:
1722
fetch-depth: 0
1823

19-
- uses: actions/setup-go@v4
20-
21-
- uses: docker/login-action@v2
24+
- name: 🚧️ Make release
25+
uses: goreleaser/goreleaser-action@v4
26+
if: startsWith(github.ref, 'refs/tags/')
27+
env:
28+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
2229
with:
23-
username: ${{ secrets.DOCKER_LOGIN }}
24-
password: ${{ secrets.DOCKER_PASSWORD }}
30+
version: latest
31+
args: release --clean
32+
33+
- name: 🧪 Set up Docker Buildx
34+
uses: docker/setup-buildx-action@v2
2535

26-
- uses: docker/login-action@v2
36+
- name: 🔒 Log in to the Container registry
37+
uses: docker/login-action@v2
2738
with:
28-
registry: ghcr.io
29-
username: ${{ github.repository_owner }}
39+
registry: ${{ env.REGISTRY }}
40+
username: ${{ github.actor }}
3041
password: ${{ secrets.GITHUB_TOKEN }}
3142

32-
- name: Prepare Env Vars
33-
run: |
34-
echo GHCR_USER=$(echo ${{ github.repository_owner }} | tr '[:upper:]' '[:lower:]') >> $GITHUB_ENV
35-
36-
# Publish a new release from git tag.
37-
- uses: goreleaser/goreleaser-action@v4.2.0
38-
if: startsWith(github.ref, 'refs/tags/')
39-
with:
40-
version: latest
41-
args: release --rm-dist
43+
- name: 🏗️ Build container and push
44+
uses: docker/build-push-action@v4
4245
env:
43-
DOCKERHUB_USER: ${{ secrets.DOCKER_LOGIN }}
44-
GHCR_USER: ${{ env.GHCR_USER }}
45-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
46+
TAG: ${{ github.ref_name }}
47+
COMMIT: ${{ github.sha }}
48+
with:
49+
cache-from: type=gha
50+
cache-to: type=gha,mode=max
51+
platforms: linux/amd64,linux/arm64
52+
push: true
53+
tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest, ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:v${{ github.ref_name }}

.goreleaser.yml

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,6 @@ builds:
1919
- arm
2020
- arm64
2121

22-
dockers:
23-
- image_templates:
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"
29-
3022
archives:
3123
- replacements:
3224
darwin: Darwin

0 commit comments

Comments
 (0)