Deployment: Create release #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: 'Deployment: Create release' | |
# Check out https://help.github.com/en/articles/workflow-syntax-for-github-actions for documentation on Actions. | |
on: | |
deployment_status | |
jobs: | |
create-release: | |
name: "Create release" | |
if: ${{ github.event.deployment_status.state == 'success' && github.event.deployment_status.environment == 'production aws' }} | |
runs-on: ubuntu-latest | |
steps: | |
- name: "Output tag name and commit" | |
id: tag-info | |
env: | |
deploymentState: ${{ github.event.deployment_status.state }} | |
deploymentEnvironment: ${{ github.event.deployment_status.environment }} | |
run: | | |
# Construct a release time that looks something like "2023-09-28-at-13-5". | |
export RELEASE_TIME=$(date +"%Y-%m-%d-at-%H-%M") | |
echo "Release time: $RELEASE_TIME" | |
echo "Commit: $GITHUB_SHA" | |
echo "name=deployment-$RELEASE_TIME" >> $GITHUB_OUTPUT | |
echo "commit=$GITHUB_SHA" >> $GITHUB_OUTPUT | |
echo "deploymentState: $deploymentState" | |
echo "deploymentEnvironment: $deploymentEnvironment" | |
- uses: ncipollo/[email protected] | |
with: | |
# Automatically create the tag from the commit if it doesn't exist. | |
tag: ${{ steps.tag-info.output.name }} | |
commit: ${{ steps.tag-info.output.commit }} | |
name: "Release ${{ steps.tag-info.output.commit }}" | |
# Automatically generate the release notes, which can be configured. See more here | |
# https://docs.github.com/en/repositories/releasing-projects-on-github/automatically-generated-release-notes. | |
generateReleaseNotes: true | |
# Mark the deployment as the latest. | |
makeLatest: true |