Workflow file for this run
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: Update tag vMAJOR upon release of newest vMAJOR.MINOR.PATCH version | |
on: | |
release: | |
types: [published] | |
env: | |
PUBLISH_UPDATE_BRANCH: master | |
GIT_USER_NAME: OPTIMADE Developers | |
GIT_USER_EMAIL: "[email protected]" | |
jobs: | |
publish: | |
name: Publish OPTIMADE validator action | |
runs-on: ubuntu-latest | |
if: github.repository == 'Materials-Consortia/optimade-validator-action' && startsWith(github.ref, 'refs/tags/v') | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Set up Python 3.10 | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.10' | |
- name: Install Python dependencies | |
run: | | |
python -m pip install -U pip | |
pip install -U setuptools wheel | |
while IFS="" read -r line || [ -n "${line}" ]; do | |
if [[ "${line}" =~ ^invoke.*$ ]]; then | |
invoke="${line}" | |
fi | |
done < requirements.txt | |
pip install ${invoke} | |
- name: Setup changelog configuration | |
id: changelog_config | |
run: | | |
echo "project=$(echo $GITHUB_REPOSITORY | cut -d/ -f2- )" >> $GITHUB_OUTPUT | |
echo "exclude_labels=duplicate,question,invalid,wontfix,docker_dependencies" >> $GITHUB_OUTPUT | |
# For the release-specific changelog | |
echo "output_file=release_changelog.md" >> $GITHUB_OUTPUT | |
- name: Update changelog | |
uses: docker://githubchangeloggenerator/github-changelog-generator:1.16.2 | |
with: | |
args: --user "${{ github.repository_owner }}" --project "${{ steps.changelog_config.outputs.project }}" --token "${{ secrets.RELEASE_PAT_CASPER }}" --release-branch "${{ env.PUBLISH_UPDATE_BRANCH }}" --exclude-labels "${{ steps.changelog_config.outputs.exclude_labels }}" | |
- name: Update version and tags | |
run: .github/utils/update_version.sh | |
- name: Update '${{ env.PUBLISH_UPDATE_BRANCH }}' | |
uses: CasperWA/push-protected@v2 | |
with: | |
token: ${{ secrets.RELEASE_PAT_CASPER }} | |
branch: ${{ env.PUBLISH_UPDATE_BRANCH }} | |
unprotect_reviews: true | |
force: true | |
tags: true | |
- name: Get previous version | |
id: get_previous_version | |
run: echo "previous_version=$(git tag -l --sort -version:refname | sed -n 2p)" >> $GITHUB_OUTPUT | |
- name: Create release-specific changelog | |
uses: docker://githubchangeloggenerator/github-changelog-generator:1.16.2 | |
with: | |
args: --user "${{ github.repository_owner }}" --project "${{ steps.changelog_config.outputs.project }}" --token "${{ secrets.RELEASE_PAT_CASPER }}" --release-branch "${{ env.PUBLISH_UPDATE_BRANCH }}" --since-tag "${{ steps.get_previous_version.outputs.previous_version }}" --output "${{ steps.changelog_config.outputs.output_file }}" --exclude-labels "${{ steps.changelog_config.outputs.exclude_labels }}" --usernames-as-github-logins | |
- name: Append changelog to release body | |
run: | | |
gh api /repos/${{ github.repository }}/releases/${{ github.event.release.id }} --jq '.body' > release_body.md | |
cat ${{ steps.changelog_config.outputs.output_file }} >> release_body.md | |
gh api /repos/${{ github.repository }}/releases/${{ github.event.release.id }} -X PATCH -F body='@release_body.md' | |
env: | |
GITHUB_TOKEN: ${{ secrets.RELEASE_PAT_CASPER }} |