From e41d0ae96212c60d995fff95d1c7166480aa8a78 Mon Sep 17 00:00:00 2001 From: Stefan van der Walt Date: Fri, 15 Nov 2024 15:35:05 -0800 Subject: [PATCH] Push tag as part of automated release --- .github/workflows/release.yaml | 31 +++++++++++++++++++------------ 1 file changed, 19 insertions(+), 12 deletions(-) diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 5734875..c308bfb 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -4,9 +4,11 @@ on: push # schedule: # - cron: "0 1 * * 0" # 01:00 on Sundays, https://crontab.guru/#0_1_*_*_0 +permissions: + contents: write # to make release + jobs: devstats-release: - if: startsWith(github.ref, 'refs/tags/') runs-on: ubuntu-latest steps: - uses: stefanv/devstats-query-action@main @@ -30,31 +32,36 @@ jobs: with: name: devstats-scientific-python - - uses: actions/checkout@v4 - with: - repository: scientific-python/devstats - path: devstats - - name: Set variables shell: bash run: | ISODATE=$(date +"%Y-%m-%d") echo "ISODATE=$ISODATE" >> $GITHUB_ENV - - name: Bundle queries + - uses: actions/checkout@v4 + + - name: Push date as tag shell: bash run: | - FILENAME=$ISODATE-devstats-queries.tar.xz - tar cfJ $FILENAME --strip-components=3 devstats/devstats/queries/* + git config user.name github-actions + git config user.email github-actions@github.com + git tag -a $ISODATE -m "Release $ISODATE" + git push origin $ISODATE - - name: List all files + - uses: actions/checkout@v4 + with: + repository: scientific-python/devstats + path: devstats + + - name: Bundle queries shell: bash run: | - ls -R + FILENAME=$ISODATE-devstats-queries.tar.xz + tar cfJ $FILENAME --strip-components=3 devstats/devstats/queries/* - name: Release uses: softprops/action-gh-release@v2 with: - token: ${{ secrets.RELEASE_TOKEN }} # Needs to have Contents: read and write permission + tag_name: ${{ env.ISODATE }} files: | *.xz