Skip to content

Update binaries name pattern (#11) #6

Update binaries name pattern (#11)

Update binaries name pattern (#11) #6

name: Publish Docker image
on:
workflow_dispatch:
inputs:
tag:
description: 'The tag to build'
required: false
type: string
default: 'main'
push:
branches: [main]
tags: ['v*']
paths: ['src/**', '.github/workflows/**', 'docker/**', 'Dockerfile']
env:
IMAGE_NAME: ${{ github.repository }}
REGISTRY: ghcr.io
jobs:
push_to_registry:
name: Push Docker image to GitHub Packages
runs-on: ubuntu-latest
env:
PACKAGE_VERSION: ${{github.event.inputs.tag || github.ref_name || 'v0.1.0'}}
steps:
- id: get-version
run: |
PACKAGE_VERSION=$(echo $PACKAGE_VERSION | sed s/^v//)
echo "::set-output name=version::$PACKAGE_VERSION"
- name: Check out the repo
uses: actions/checkout@v3
with:
submodules: true
ref: ${{github.event.inputs.tag || ''}}
- name: Login to docker registry
uses: docker/[email protected]
with:
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
registry: ${{ env.REGISTRY }}
- name: Push to GitHub Packages - Nightly
if: github.ref == 'refs/heads/main' || github.event.inputs.tag == 'main'
uses: docker/[email protected]
with:
push: true
tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:nightly
secrets: |
"user=${{ secrets.NUGET_USER }}"
"token=${{ secrets.NUGET_PASSWORD }}"
- name: Push to GitHub Packages - Release
if: startsWith(github.ref, 'refs/tags/v') || startsWith(github.event.inputs.tag, 'v')
uses: docker/[email protected]
with:
push: true
tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest,${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ steps.get-version.outputs.version }}
secrets: |
"user=${{ secrets.NUGET_USER }}"
"token=${{ secrets.NUGET_PASSWORD }}"