Update versions #101
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 versions | |
on: | |
workflow_dispatch: | |
schedule: | |
- cron: "0 0 * * 0" | |
permissions: | |
contents: write | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
ref: master | |
token: ${{ secrets.PAT }} | |
- name: Set up Python 3 | |
uses: actions/setup-python@v5 | |
with: | |
python-version: 3.11 | |
- name: Run | |
id: run | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
python3 update_versions.py | |
echo $(cat versions.json) | |
git add versions.json | |
if git diff --cached --exit-code; then | |
echo "Nothing changed" | |
echo "release=false" >> $GITHUB_OUTPUT | |
else | |
git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com" | |
git config --global user.name "github-actions[bot]" | |
version=$(date +'%Y%m%d-%H%M') | |
git commit -m "chore: bump versions $version" | |
git tag $version | |
git push origin master --tags | |
echo "[ghcr.io/${{ github.repository }}:$version](https://ghcr.io/${{ github.repository }}) Built using: $(jq -r 'to_entries | map("\n- \(.key): \(.value)") | .[]' versions.json)" > notes.txt | |
echo "release=true" >> $GITHUB_OUTPUT | |
echo "version=$version" >> $GITHUB_OUTPUT | |
fi | |
- name: Release | |
if: ${{ steps.run.outputs.release == 'true' }} | |
uses: softprops/action-gh-release@v2 | |
with: | |
tag_name: ${{ steps.run.outputs.version }} | |
name: ${{ steps.run.outputs.version }} | |
body_path: notes.txt |