Skip to content

Merge pull request #402 from sinamics/update-zerotier #72

Merge pull request #402 from sinamics/update-zerotier

Merge pull request #402 from sinamics/update-zerotier #72

Workflow file for this run

# Build new docker image when a new tag is pushed, and generate changelog and release notes and use the tag as the release name.
# if the tag has beta or alfa in the name, set the release as a pre-release.
name: Build release image
on:
push:
tags:
- "v*"
# trigger workflow manually
workflow_dispatch:
inputs:
version:
description: "Release version (e.g. v0.0.2)"
required: true
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
ref: main
fetch-depth: 0
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: "Get Previous tag"
id: previoustag
uses: "WyriHaximus/github-action-get-previous-tag@v1"
- name: Extract version number
id: extract_version
run: |
echo "raw_tag=${{ steps.previoustag.outputs.tag }}"
version_number="${{ steps.previoustag.outputs.tag }}"
if [[ ${version_number:0:1} == "v" ]]; then
version_number=${version_number:1}
fi
echo "version_number=$version_number"
echo "::set-output name=version_number::$version_number"
- name: Build and push
id: docker_build
uses: docker/build-push-action@v3
with:
context: .
file: ./Dockerfile
platforms: linux/amd64,linux/arm64
push: true
build-args: |
"NEXT_PUBLIC_APP_VERSION=${{ steps.previoustag.outputs.tag }}"
tags: |
${{ secrets.DOCKER_USERNAME }}/${{ secrets.DOCKER_REPOSITORY }}:latest
${{ secrets.DOCKER_USERNAME }}/${{ secrets.DOCKER_REPOSITORY }}:${{ steps.extract_version.outputs.version_number }}
# - uses: "marvinpinto/action-automatic-releases@latest"
# with:
# repo_token: "${{ secrets.GITHUB_TOKEN }}"
# prerelease: ${{ contains(github.ref, 'beta') || contains(github.ref, 'alfa') }}
# files: |
# LICENSE
# README.md
# prerelease: ${{ contains(github.ref, 'beta') || contains(github.ref, 'alfa') }}
# automatic_release_tag: ${{ github.event.inputs.version || steps.previoustag.outputs.tag }}
# title: ${{ steps.previoustag.outputs.tag }}