publish-new-version #30
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-new-version | |
on: | |
workflow_dispatch: | |
inputs: | |
version: | |
description: "Version being published" | |
required: true | |
jobs: | |
publish: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Validate version format | |
run: echo "${{ github.event.inputs.version }}" | grep -E "^[0-9]{4}\.(0[1-9]|1[0-2])\.[1-9][0-9]*$" | |
- name: Ensure changelog was updated with new version | |
run: grep "## \[v${{ github.event.inputs.version }}\]" CHANGELOG.md | |
- name: Write version | |
run: sed -i 's/^VERSION = "[^"]*"/VERSION = "${{ github.event.inputs.version }}"/g' lib/faexport.rb | |
- name: Commit and push git version | |
uses: EndBug/add-and-commit@v9 | |
with: | |
add: "lib/faexport.rb" | |
message: "Publishing version ${{ github.event.inputs.version }}" | |
tag: "v${{ github.event.inputs.version }}" | |
- name: Login to DockerHub | |
uses: docker/login-action@v2 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Build and push Docker images | |
uses: docker/build-push-action@v4 | |
with: | |
context: . | |
push: true | |
tags: | | |
deerspangle/furaffinity-api:version-${{ github.event.inputs.version}} | |
deerspangle/furaffinity-api:latest | |
- name: Parse changelog | |
run: sed -z "s/^.*## \[v${{ github.event.inputs.version }}\][^\n]\+\n\+\(.\+\)$/\1/" CHANGELOG.md | sed -z "s/\n\+## \[v.*$//" | tee release_changelog.md | |
- name: Publish Github release | |
uses: ncipollo/release-action@v1 | |
with: | |
bodyFile: release_changelog.md | |
tag: "v${{ github.event.inputs.version }}" | |
makeLatest: true |