Skip to content

Commit

Permalink
chore: build and push image on release (#5)
Browse files Browse the repository at this point in the history
  • Loading branch information
birme authored Aug 29, 2024
1 parent 90fbda8 commit d8fa0fe
Show file tree
Hide file tree
Showing 2 changed files with 77 additions and 0 deletions.
54 changes: 54 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
name: Build and push Docker image when a release is published

on:
release:
types: [published]

jobs:
build:
name: Build and push Docker image
runs-on: ubuntu-latest

permissions:
contents: read
packages: write

steps:
- name: Checkout
uses: actions/checkout@v3

- name: Set up QEMU
uses: docker/setup-qemu-action@v2

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

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

- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v4
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}

- name: Extract GUI version
id: gui
env:
TAGS: ${{ steps.meta.outputs.tags }}
run: echo "::set-output name=version::${TAGS##*:}"

- name: Build and push Docker image
uses: docker/build-push-action@v3
with:
context: .
push: true
build-args: |
GUI_VERSION=${{ steps.gui.outputs.version }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
platforms: linux/amd64,linux/arm64
23 changes: 23 additions & 0 deletions RELEASE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
To build and publish a release of the official Docker image, in this example patch version `v1.0.1`:

1. Create a tag with name `v1.0.1`

```
% git tag v1.0.1
```

2. Push the tag to GitHub remote

```
% git push --tags
```

3. Open browser and navigate to the repository on GitHub. Go to the Releases section by clicking on the Releases header on the right side of the page.

4. Click on Create a new release and choose the tag `v1.0.1` that you created.

5. Describe the release by adding release notes in the markdown input field.

6. Click on Publish release.

This will trigger a GitHub action that will build Docker image and tag it with `v1.0.1` and push to container registry.

0 comments on commit d8fa0fe

Please sign in to comment.