Merge pull request #164 from owaspsamm/main #14
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: | |
pull_request: | |
branches: | |
- main | |
types: | |
- closed | |
jobs: | |
release: | |
name: Publish new release | |
runs-on: ubuntu-latest | |
if: github.event.pull_request.merged == true # only merged pull requests must trigger this job | |
steps: | |
- name: Extract version from branch name (for release branches) | |
if: startsWith(github.event.pull_request.head.ref, 'release/') | |
env: | |
BRANCH_NAME: "${{ github.event.pull_request.head.ref }}" | |
run: | | |
VERSION="${BRANCH_NAME#release/}" | |
echo "RELEASE_VERSION=$VERSION" >> "$GITHUB_ENV" | |
- name: Extract version from branch name (for hotfix branches) | |
if: startsWith(github.event.pull_request.head.ref, 'hotfix/') | |
env: | |
BRANCH_NAME: "${{ github.event.pull_request.head.ref }}" | |
run: | | |
VERSION="${BRANCH_NAME#hotfix/}" | |
echo "RELEASE_VERSION=$VERSION" >> "$GITHUB_ENV" | |
- uses: actions/checkout@v3 | |
- run: tar -cvzf samm.tar.gz images model texts | |
- name: Generate Excel spreadsheet from the model | |
uses: owaspsamm/toolbox-spreadsheet@main | |
with: | |
version: ${{ env.RELEASE_VERSION }} | |
- name: Build Changelog | |
id: github_release | |
uses: mikepenz/release-changelog-builder-action@v3 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- uses: ncipollo/release-action@v1 | |
with: | |
artifacts: samm.tar.gz, SAMM_spreadsheet.xlsx | |
tag: ${{ env.RELEASE_VERSION }} | |
token: ${{ secrets.GITHUB_TOKEN }} | |
body: ${{steps.github_release.outputs.changelog}} | |
- name: Merge main into develop branch | |
uses: thomaseizinger/create-pull-request@1.0.0 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
head: main | |
base: develop | |
title: Merge main into develop branch | |
body: | | |
This PR merges the main branch back into develop. | |
This happens to ensure that the updates that happened on the release branch, i.e. CHANGELOG and manifest updates are also present on the develop branch. |