ci: add verify steps to check if the tag name is valid for release. #5
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: Release | |
on: | |
push: | |
tags: | |
- '*' | |
jobs: | |
release: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Verify version | |
run: | | |
VERSION=$(jq -r .version info.json) | |
if [[ "${{ github.ref_name }}" != "$VERSION" ]]; then | |
echo "Tag name ${{ github.ref_name }} does not match version in info.json: $VERSION" | |
exit 1 | |
fi | |
- name: Verify changelog | |
run: | | |
if ! grep -q "Version: ${{ github.ref_name }}" changelog.txt; then | |
echo "Changelog does not contain an entry for version ${{ github.ref_name }}" | |
exit 1 | |
fi | |
- name: Create zip archive | |
run: zip -r creative-mod-${{ github.ref_name }}.zip . -x "*.git*" -x ".github*" | |
- name: Create Release | |
id: create_release | |
uses: actions/create-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag_name: ${{ github.ref_name }} | |
release_name: Release ${{ github.ref_name }} | |
draft: false | |
prerelease: false | |
- name: Upload Release Asset | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: creative-mod-${{ github.ref_name }}.zip | |
asset_name: creative-mod-${{ github.ref_name }}.zip | |
asset_content_type: application/zip |