Skip to content

Add official docker support #9

Add official docker support

Add official docker support #9

name: Build and release accweb
on:
push:
tags:
- '*'
jobs:
build-accweb:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout and setup
uses: actions/checkout@v2
- name: Setup go
uses: actions/setup-go@v2
with:
go-version: '^1.21.0'
- name: Get the version
id: get_version
run: echo ::set-output name=VERSION::${GITHUB_REF/refs\/tags\//}
- name: Build accweb release
run: chmod u+x ./build/build_release.sh && ./build/build_release.sh ${{ steps.get_version.outputs.VERSION }}
- uses: ncipollo/release-action@v1
with:
artifacts: 'releases/accweb_${{ steps.get_version.outputs.VERSION }}.zip'
generateReleaseNotes: true
token: ${{ secrets.GITHUB_TOKEN }}
- name: Docker meta
id: meta
uses: docker/metadata-action@v5
with:
# list of Docker images to use as base name for tags
images: |
name/app
# generate Docker tags based on the following events/attributes
tags: |
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and push
uses: docker/build-push-action@v5
with:
build-args: |
VERSION=${{ steps.get_version.outputs.VERSION }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}