release-after-build #3
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-after-build | |
on: | |
push: | |
# consider only release and pre-release tags | |
tags: | |
- 'v?[0-9]+.[0-9]+' | |
- 'v?[0-9]+.[0-9]+.[0-9]+' # tag format currently used | |
- 'v?[0-9]+.[0-9]+.[0-9]+-rc[0-9]+' | |
workflow_dispatch: | |
inputs: | |
bump_type: | |
description: 'Select type of version to create: major: x.0 (1.0, 2.0,...) or minor: 1.x (1.1, 1.2,...)' | |
required: true | |
type: choice | |
options: | |
- minor | |
- major | |
default: minor | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: checkout | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Bump version and push tag | |
id: bump-version | |
if: success() && github.event_name == 'workflow_dispatch' | |
uses: ietf-tools/semver-action@v1 | |
with: | |
token: ${{ github.token }} | |
branch: master | |
noNewCommitBehavior: warn | |
- name: create bosh release | |
id: create-final-bosh-release | |
uses: orange-cloudfoundry/[email protected] | |
if: success() && (startsWith(github.ref, 'refs/tags/') || github.event_name == 'workflow_dispatch') | |
with: | |
target_branch: ${{github.ref_name}} | |
tag_name: ${{steps.bump-version.outputs.next}} | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
AWS_BOSH_ACCES_KEY_ID: ${{ secrets.AWS_BOSH_ACCES_KEY_ID }} | |
AWS_BOSH_SECRET_ACCES_KEY: ${{ secrets.AWS_BOSH_SECRET_ACCES_KEY }} | |
# see https://github.com/ncipollo/release-action | |
- name: create github release | |
id: create-github-release | |
uses: ncipollo/[email protected] | |
with: | |
tag: ${{ steps.create-final-bosh-release.outputs.tagged_version }} | |
draft: false | |
allowUpdates: false # > indicates if we should update a release if it already exists. | |
generateReleaseNotes: true | |
artifacts: ./${{ steps.create-final-bosh-release.outputs.file }} | |
artifactContentType: application/zip | |
artifactErrorsFailBuild: true # > indicates if artifact read or upload errors should fail the build. |