Manual Docker Build and Publish #8
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: Manual Docker Build and Publish | |
on: | |
workflow_dispatch: # This enables manual trigger from GitHub UI or API | |
jobs: | |
build_and_publish: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out the repo | |
uses: actions/checkout@v2 | |
- uses: actions-ecosystem/action-get-latest-tag@v1 | |
id: get-latest-tag | |
- uses: actions-ecosystem/action-bump-semver@v1 | |
id: bump-semver | |
with: | |
current_version: ${{ steps.get-latest-tag.outputs.tag }} | |
level: minor | |
- uses: actions-ecosystem/action-push-tag@v1 | |
with: | |
tag: ${{ steps.bump-semver.outputs.new_version }} | |
message: '${{ steps.bump-semver.outputs.new_version }}: PR #${{ github.event.pull_request.number }} ${{ github.event.pull_request.title }}' | |
- name: Login to Docker Hub | |
uses: docker/login-action@343f7c4344506bcbf9b4de18042ae17996df046d # v3.0.0 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Build and push Docker image | |
uses: docker/build-push-action@v5 | |
with: | |
context: "{{defaultContext}}:docker" | |
file: ./Dockerfile | |
push: true | |
tags: pixeematt/pixee-cli:latest, pixeematt/pixee-cli:${{ steps.bump-semver.outputs.new_version }} |