LittlePaimon/.github/workflows/release_docker.yaml
2023-06-14 19:35:11 +08:00

43 lines
1.1 KiB
YAML

name: Release Docker Image
on:
push:
tags:
- v**
workflow_dispatch:
jobs:
Release:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup Docker Buildx Command
id: buildx
uses: docker/setup-buildx-action@master
- name: Login to docker registry
uses: docker/login-action@v2
with:
registry: ${{ secrets.DOCKER_IMAGE_REGISTRY }}
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Get Docker Image Url
id: image
env:
URL: ${{ secrets.DOCKER_IMAGE_REGISTRY }}${{ secrets.DOCKER_IMAGE_PATH }}
run: |
echo LATEST=${URL}:latest >> $GITHUB_OUTPUT
echo VERSION=${URL}:${GITHUB_REF/refs\/tags\//} >> $GITHUB_OUTPUT
- name: Build Docker Image and Push
id: docker_build
uses: docker/build-push-action@v2
with:
push: true
context: .
file: ./dockerfile
tags: ${{ steps.image.outputs.VERSION }},${{ steps.image.outputs.LATEST }}