Skip to content

Commit

Permalink
Rework release
Browse files Browse the repository at this point in the history
  • Loading branch information
mxpv committed May 5, 2023
1 parent 5c29072 commit 947ac53
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 31 deletions.
54 changes: 31 additions & 23 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,37 +9,45 @@ jobs:
publish:
name: Publish
runs-on: ubuntu-latest
timeout-minutes: 10
timeout-minutes: 20

permissions:
contents: write
packages: write

steps:
- uses: actions/checkout@v3
- name: 📦 Checkout repository
uses: actions/checkout@v3
with:
fetch-depth: 0

- uses: actions/setup-go@v4

- uses: docker/login-action@v2
- name: 🚧️ Make release
uses: goreleaser/goreleaser-action@v4
if: startsWith(github.ref, 'refs/tags/')
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
username: ${{ secrets.DOCKER_LOGIN }}
password: ${{ secrets.DOCKER_PASSWORD }}
version: latest
args: release --clean

- name: 🧪 Set up Docker Buildx
uses: docker/setup-buildx-action@v2

- uses: docker/login-action@v2
- name: 🔒 Log in to the Container registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Prepare Env Vars
run: |
echo GHCR_USER=$(echo ${{ github.repository_owner }} | tr '[:upper:]' '[:lower:]') >> $GITHUB_ENV
# Publish a new release from git tag.
- uses: goreleaser/[email protected]
if: startsWith(github.ref, 'refs/tags/')
with:
version: latest
args: release --rm-dist
- name: 🏗️ Build container and push
uses: docker/build-push-action@v4
env:
DOCKERHUB_USER: ${{ secrets.DOCKER_LOGIN }}
GHCR_USER: ${{ env.GHCR_USER }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
TAG: ${{ github.ref_name }}
COMMIT: ${{ github.sha }}
with:
cache-from: type=gha
cache-to: type=gha,mode=max
platforms: linux/amd64,linux/arm64
push: true
tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest, ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:v${{ github.ref_name }}
8 changes: 0 additions & 8 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,6 @@ builds:
- arm
- arm64

dockers:
- image_templates:
- "{{ .Env.DOCKERHUB_USER }}/podsync:{{ .Tag }}"
- "{{ .Env.DOCKERHUB_USER }}/podsync:v{{ .Major }}.{{ .Minor }}"
- "{{ .Env.DOCKERHUB_USER }}/podsync:latest"
- "ghcr.io/{{ .Env.GHCR_USER }}/podsync:{{ .Tag }}"
- "ghcr.io/{{ .Env.GHCR_USER }}/podsync:latest"

archives:
- replacements:
darwin: Darwin
Expand Down

0 comments on commit 947ac53

Please sign in to comment.