This repository has been archived by the owner on Jan 24, 2024. It is now read-only.
Allow manual triggers of image build workflow #19
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: Build and publish docker image to GitHub registry | |
on: | |
workflow_dispatch: | |
push: | |
branches: | |
- 'master' | |
tags: | |
- '*' | |
env: | |
GO_VERSION: "1.20" | |
NODE_VERSION: "20" | |
OPENVPN_VERSION: "2.6.5" | |
REGISTRY: ghcr.io | |
IMAGE_NAME: ${{ github.repository }}/ovpn-admin | |
IMAGE_TAG: latest | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
id: docker_checkout | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Log in to the Container registry | |
id: docker_login | |
uses: docker/login-action@v2 | |
with: | |
registry: ${{ env.REGISTRY }} | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Set image_tag for tag pushes | |
id: docker_tag | |
run: | | |
echo "IMAGE_TAG=${{ github.ref_name }}" >> $GITHUB_ENV | |
if: github.ref_type == 'tag' | |
- name: Build and push ovpn-admin image | |
id: docker_build | |
uses: docker/build-push-action@v3 | |
with: | |
context: ./ | |
file: ./Dockerfile | |
target: admin-webui | |
build-args: | | |
GO_VERSION=${{ env.GO_VERSION }} | |
NODE_VERSION=${{ env.NODE_VERSION }} | |
OPENVPN_VERSION=${{ env.OPENVPN_VERSION }} | |
push: true | |
tags: | | |
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ env.IMAGE_TAG }} |