2FAuth/.github/workflows/ci-docker-release.yml

60 lines
1.9 KiB
YAML
Raw Normal View History

name: ci-docker-release
on:
release:
types: [published]
jobs:
publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2.3.4
with:
ref: ${{ github.event.release.tag_name }}
- uses: docker/setup-qemu-action@v1
- uses: docker/setup-buildx-action@v1
- uses: docker/login-action@v1
with:
username: 2fauth
password: ${{ secrets.DOCKERHUB_PASSWORD }}
- name: Set version
uses: actions/github-script@v4
id: set_version
with:
script: |
const tag = context.ref.substring(10)
const version = tag.replace('v', '')
core.setOutput('version', version)
- name: Set variables
id: set_vars
env:
EVENT_NAME: ${{ github.event_name }}
run: |
echo ::set-output name=commit::$(git rev-parse --short HEAD)
echo ::set-output name=created::$(date -u +%Y-%m-%dT%H:%M:%SZ)
echo ::set-output name=platforms::linux/amd64,linux/386,linux/arm64,linux/arm/v6,linux/arm/v7
- name: Update Docker Hub Description
uses: peter-evans/dockerhub-description@v2.4.3
with:
username: 2fauth
password: ${{ secrets.DOCKERHUB_PASSWORD }}
repository: 2fauth/2fauth
short-description: A web app to manage your Two-Factor Authentication (2FA) accounts and generate their security codes
readme-filepath: docker/README.md
- name: Build and push to docker Hub
uses: docker/build-push-action@v2.6.1
with:
platforms: ${{ steps.set_vars.outputs.platforms }}
build-args: |
CREATED=${{ steps.set_vars.outputs.created }}
COMMIT=${{ steps.set_vars.outputs.commit }}
VERSION=${{ steps.set_version.outputs.version }}
tags: |
2fauth/2fauth:${{ steps.set_version.outputs.version }}
push: true