v1.0.0 #2
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Donut Release Build | |
on: | |
release: | |
types: [published] | |
workflow_dispatch: | |
inputs: | |
tag: | |
description: 'Tag version' | |
required: true | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Setup go version | |
uses: actions/setup-go@v3 | |
with: | |
go-version: '1.21.0' | |
- name: Login to GitHub Container Registry | |
uses: docker/login-action@v2 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.DOCKER_GITHUB_TOKEN }} | |
- name: Set output release tag | |
id: release | |
if: github.event_name == 'release' | |
run: echo ::set-output name=tag::${{ github.event.release.tag_name }} | |
- name: Set output release tag | |
id: dispatch | |
if: github.event_name == 'workflow_dispatch' | |
run: echo ::set-output name=tag::${{ github.event.inputs.tag }} | |
- name: Build docker image for donut | |
run: | | |
RELEASE_VERSION=${{ github.event.release.tag_name }} | |
if [[ "${{ github.event_name }}" == 'workflow_dispatch' ]]; then | |
RELEASE_VERSION=${{ github.event.inputs.tag }} | |
fi | |
RELEASE_VERSION="${RELEASE_VERSION#?}" | |
echo $RELEASE_VERSION | |
go version | |
docker build . -t ghcr.io/mocha-bot/donut:$RELEASE_VERSION -t ghcr.io/mocha-bot/donut:latest | |
docker push ghcr.io/mocha-bot/donut:$RELEASE_VERSION | |
docker push ghcr.io/mocha-bot/donut:latest |