Repository navigation
Make release publication idempotent #3
Workflow file for this run
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: Release | |
| on: | |
| push: | |
| tags: | |
| - 'v*' | |
| permissions: | |
| contents: write | |
| jobs: | |
| release: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: shivammathur/setup-php@v2 | |
| with: | |
| php-version: '8.2' | |
| extensions: zip | |
| coverage: none | |
| - uses: ramsey/composer-install@v3 | |
| - run: composer validate --strict | |
| - run: composer lint | |
| - run: composer test | |
| - run: php bin/build.php | |
| - run: unzip -t dist/zipquantum-smart-links.zip | |
| - name: Generate checksum | |
| run: sha256sum dist/zipquantum-smart-links.zip > dist/zipquantum-smart-links.zip.sha256 | |
| - name: Publish GitHub Release | |
| env: | |
| GH_TOKEN: ${{ github.token }} | |
| run: | | |
| if gh release view "${GITHUB_REF_NAME}" >/dev/null 2>&1; then | |
| gh release upload "${GITHUB_REF_NAME}" \ | |
| dist/zipquantum-smart-links.zip \ | |
| dist/zipquantum-smart-links.zip.sha256 \ | |
| --clobber | |
| else | |
| gh release create "${GITHUB_REF_NAME}" \ | |
| dist/zipquantum-smart-links.zip \ | |
| dist/zipquantum-smart-links.zip.sha256 \ | |
| --generate-notes \ | |
| --title "ZipQuantum for WordPress ${GITHUB_REF_NAME}" | |
| fi |