release-triggered #104
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: Release Docker image | |
on: | |
repository_dispatch: | |
types: | |
- release-triggered | |
- manual-release-triggered | |
workflow_dispatch: | |
inputs: | |
increment: | |
description: Increment | |
default: "null" | |
type: choice | |
options: | |
- "null" | |
- major | |
- minor | |
- patch | |
# Sets the first part of the Docker tag - this will update the VERSION file | |
version: | |
description: "Custom version, requires increment to be set" | |
required: false | |
tag: | |
description: "Custom Docker image tag (note - this won't update the VERSION file and is for non-prod releases only)" | |
required: false | |
push_to_latest: | |
description: 'Should push to latest' | |
type: boolean | |
default: true | |
docker_repository: | |
description: The Docker repository to which the image should be published | |
default: pactfoundation | |
jobs: | |
release: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- uses: ruby/setup-ruby@v1 | |
- name: Bundle install | |
run: bundle install | |
- name: Log into ghcr registry | |
if: github.event_name != 'pull_request' | |
uses: docker/login-action@343f7c4344506bcbf9b4de18042ae17996df046d # v3.0.0 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Release image | |
run: script/release-workflow/run.sh | |
env: | |
DOCKER_HUB_USERNAME: ${{ secrets.DOCKER_HUB_USERNAME }} | |
DOCKER_HUB_TOKEN: ${{ secrets.DOCKER_HUB_TOKEN }} | |
DOCKER_IMAGE_ORG_AND_NAME: pactfoundation/pact-cli # Below is only set on workflow_dispatch, not workflow triggers | |
# DOCKER_IMAGE_ORG_AND_NAME: ${{ github.event.inputs.docker_repository }}/pact-cli | |
VERSION: ${{ github.event.inputs.version }} | |
INCREMENT: ${{ github.event.client_payload.increment }}${{ github.event.inputs.increment }} | |
CUSTOM_TAG: ${{ github.event.client_payload.tag }}${{ github.event.inputs.tag }} | |
# populate INCREMENT from workflow_dispatch or repository_dispatch | |
PUSH_TO_LATEST: ${{ github.event.inputs.push_to_latest }} |