ci: Add GitHub Action to create releases on GitHub and Docker Hub #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: Release | |
on: | |
push: | |
tags: | |
- "v*.*.*" | |
branches: | |
- master | |
pull_request: {} | |
jobs: | |
# create-github-release: | |
# runs-on: ubuntu-latest | |
# steps: | |
# - name: Checkout code | |
# uses: actions/checkout@v4 | |
# - name: Get current tag | |
# id: current_tag | |
# uses: WyriHaximus/github-action-get-previous-tag@v1 | |
# - name: Release new version | |
# uses: softprops/action-gh-release@v2 | |
# with: | |
# name: ${{ steps.current_tag.outputs.tag }} | |
# body: "⚠️ Changelog not yet provided." | |
# env: | |
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
ship-docker-image: | |
# needs: create-github-release | |
environment: build-ship | |
runs-on: ubuntu-latest | |
permissions: | |
packages: write | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
with: | |
submodules: true | |
- name: Acquire Docker image metadata | |
id: metadata | |
uses: docker/metadata-action@v5 | |
with: | |
images: | | |
${{ vars.DOCKERHUB_USERNAME }}/prose-pod-api | |
ghcr.io/${{ github.repository }} | |
# NOTE: `latest` tag automatically handled (see https://github.com/docker/metadata-action?tab=readme-ov-file#latest-tag). | |
tags: | | |
type=semver,pattern={{version}} | |
type=semver,pattern={{major}}.{{minor}} | |
type=semver,pattern={{major}} | |
type=edge | |
- name: echo | |
run: | | |
echo "tags: ${{ steps.metadata.outputs.tags }}" | |
echo "labels: ${{ steps.metadata.outputs.labels }}" | |
# - name: Login to Docker Hub | |
# uses: docker/login-action@v3 | |
# with: | |
# username: ${{ vars.DOCKERHUB_USERNAME }} | |
# password: ${{ secrets.DOCKERHUB_TOKEN }} | |
# - name: Log in to the container registry | |
# uses: docker/login-action@v3 | |
# with: | |
# registry: ghcr.io | |
# username: ${{ github.actor }} | |
# password: ${{ secrets.GITHUB_TOKEN }} | |
# - name: Build and push Docker image | |
# uses: docker/build-push-action@v6 | |
# with: | |
# tags: ${{ steps.metadata.outputs.tags }} | |
# labels: ${{ steps.metadata.outputs.labels }} | |
# push: true |