diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 00000000..f65f1489 --- /dev/null +++ b/.github/workflows/release.yml @@ -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 diff --git a/RELEASE.md b/RELEASE.md new file mode 100644 index 00000000..ef69de60 --- /dev/null +++ b/RELEASE.md @@ -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.