Skip to content

Commit

Permalink
Simplify release flow
Browse files Browse the repository at this point in the history
  • Loading branch information
ivov committed Nov 24, 2024
1 parent 39bd322 commit 8e4d86d
Showing 1 changed file with 16 additions and 28 deletions.
44 changes: 16 additions & 28 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,45 +5,33 @@ on:
tags:
- 'v*.*.*'

env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
permissions:
packages: write

jobs:
build-and-push:
build-and-publish:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write

steps:
- name: Checkout repository
uses: actions/[email protected]
- uses: actions/[email protected]

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Set release version
# `#v` to strip the `v` prefix: v1.2.3 -> 1.2.3
run: echo "RELEASE_VERSION=${GITHUB_REF_NAME#v}" >> $GITHUB_ENV

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

- name: Extract metadata (tags, labels) for Docker image
id: meta
uses: docker/metadata-action@v4
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
type=semver,pattern={{version}}
type=raw,value=latest,enable={{is_default_branch}}
- name: Build and push Docker image to GHCR
uses: docker/build-push-action@v4
- name: Build Docker image and publish to GHCR
uses: docker/[email protected]
with:
context: .
push: true
platforms: linux/amd64,linux/arm64
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
platforms: linux/arm64
tags: |
ghcr.io/ivov/n8n-shortlink:latest
ghcr.io/ivov/n8n-shortlink:${{ env.RELEASE_VERSION }}

0 comments on commit 8e4d86d

Please sign in to comment.