idrlnet/.github/workflows/docker.yml

45 lines
1.2 KiB
YAML
Raw Normal View History

2021-07-13 11:11:40 +08:00
name: docker-build-push
on:
push:
2021-07-15 10:53:07 +08:00
branches: [master]
2021-07-13 16:24:19 +08:00
pull_request:
branches: [master]
release:
2021-07-15 10:53:07 +08:00
types: [published, edited]
2021-07-13 16:24:19 +08:00
2021-07-13 11:11:40 +08:00
jobs:
docker:
runs-on: ubuntu-latest
steps:
-
name: Set up QEMU
uses: docker/setup-qemu-action@v1
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
-
name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
-
2021-07-15 10:53:07 +08:00
name: Print event_name
run: echo "$GITHUB_EVENT_NAME, ${{ github.event_name }}, ${{ github.event.release.tag_name }}"
2021-07-13 16:24:19 +08:00
-
name: Get release version
if: github.event_name == 'release'
id: get_version
run: echo "::set-output name=RELEASE_VERSION::${{ github.event.release.tag_name }}"
-
name: Publish Releases to Dockerhub
if: github.event_name == 'release'
uses: docker/build-push-action@v2
with:
push: true
tags: ${{ secrets.DOCKERHUB_USERNAME }}/idrlnet:${{ steps.get_version.outputs.RELEASE_VERSION }}
2021-07-15 10:53:07 +08:00
file: Dockerfile