Create monthly release #17
This file contains hidden or 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: Create monthly release | |
| on: | |
| workflow_dispatch: {} | |
| schedule: | |
| - cron: '0 9 1 * *' | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Run the script | |
| env: | |
| USER_ID: ${{ secrets.USER_ID }} | |
| run: php update.php | |
| - name: Commit changes | |
| run: | | |
| git config --global user.name "GitHub Actions" | |
| git config --global user.email "[email protected]" | |
| git add . | |
| git commit -m "update $(date '+%Y-%m-%d')" || echo "No changes to commit" | |
| git push | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Get latest commit SHA | |
| id: get_sha | |
| run: echo "sha=$(git rev-parse HEAD)" >> $GITHUB_OUTPUT | |
| - name: Set tag and release name | |
| id: version | |
| run: | | |
| TAG_NAME="v$(date +'%Y-%m')" | |
| RELEASE_NAME="Release $(date +'%B %Y')" | |
| echo "tag=$TAG_NAME" >> $GITHUB_OUTPUT | |
| echo "name=$RELEASE_NAME" >> $GITHUB_OUTPUT | |
| - name: Create a new release | |
| uses: actions/create-release@v1 | |
| with: | |
| tag_name: ${{ steps.version.outputs.tag }} | |
| release_name: ${{ steps.version.outputs.name }} | |
| draft: false | |
| prerelease: false | |
| commitish: ${{ steps.get_sha.outputs.sha }} | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |