publish-docker-image #14
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: publish-docker-image | |
concurrency: | |
group: ${{ github.workflow }}-${{github.event.inputs.image}}-${{ github.ref }} | |
cancel-in-progress: true | |
on: | |
workflow_dispatch: | |
inputs: | |
image: | |
type: choice | |
description: Docker image to be published | |
options: | |
- Game consumer | |
- Game service | |
- User service | |
jobs: | |
publish: | |
env: | |
DOCKER_IMAGE: > | |
${{ fromJson('{ | |
"Game consumer": "robertopintosl/one-game-backend-consumer-game", | |
"Game service": "robertopintosl/one-game-backend-service-game", | |
"User service": "robertopintosl/one-game-backend-service-user" | |
}')[github.event.inputs.image] }} | |
NPM_BUILD_SCRIPT: > | |
${{ fromJson('{ | |
"Game consumer": "docker:build:game:consumer:npm", | |
"Game service": "docker:build:game:service:npm", | |
"User service": "docker:build:user:service:npm" | |
}')[github.event.inputs.image] }} | |
name: Build and publish image | |
environment: CI | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- uses: ./.github/actions/publish-docker-image | |
with: | |
docker-image: ${{ env.DOCKER_IMAGE }} | |
docker-password: ${{ secrets.DOCKER_TOKEN }} | |
docker-username: ${{ vars.DOCKER_USERNAME }} | |
npm-build-script: ${{ env.NPM_BUILD_SCRIPT }} |