Release and publish v2.5.11 #7
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 and publish | |
run-name: Release and publish ${{ github.event.release.tag_name }} | |
on: | |
release: | |
types: [published] | |
permissions: | |
contents: write | |
concurrency: ${{ github.workflow }} | |
env: | |
TAG_NAME: ${{ github.event.release.tag_name }} | |
USERSCRIPT_FILE_PATH: dist/Simple-YouTube-Age-Restriction-Bypass.user.js | |
jobs: | |
release: | |
name: Release | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
ref: ${{ github.event.release.target_commitish }} | |
fetch-depth: 0 | |
- name: Setup node | |
uses: actions/setup-node@v4 | |
with: | |
node-version: lts/* | |
- name: Update package version | |
run: | | |
npm version "$TAG_NAME" --allow-same-version --git-tag-version false | |
- name: Install dependencies | |
run: npm ci | |
- name: Build | |
run: npm run build | |
- name: Upload assets to GitHub release | |
uses: softprops/action-gh-release@v2 | |
with: | |
files: | | |
${{ env.USERSCRIPT_FILE_PATH }} | |
dist/**/*.zip | |
- name: Commit changes | |
# Prevent running this in forks and also if this is a prerelease | |
if: github.event.repository.fork == false && github.event.release.prerelease == false | |
env: | |
COMMIT_USER_NAME: github-actions[bot] | |
COMMIT_USER_EMAIL: github-actions[bot]@users.noreply.github.com | |
COMMIT_AUTHOR: ${{ github.actor }} <${{ github.actor_id }}+${{ github.actor }}@users.noreply.github.com> | |
COMMIT_MESSAGE: Release ${{ env.TAG_NAME }} | |
COMMIT_FILES: | | |
${{ env.USERSCRIPT_FILE_PATH }} | |
*.json | |
run: | | |
git config user.name "$COMMIT_USER_NAME" | |
git config user.email "$COMMIT_USER_EMAIL" | |
git add -f $(echo "$COMMIT_FILES") | |
git commit -m "$COMMIT_MESSAGE" --author="$COMMIT_AUTHOR" | |
git push origin | |
# Update tag | |
git tag -f "$TAG_NAME" | |
git push -f origin "$TAG_NAME" | |
publish: | |
name: Publish to GreasyFork | |
needs: release | |
# Prevent running this in forks and also if this is a prerelease | |
if: github.event.repository.fork == false && github.event.release.prerelease == false | |
uses: ./.github/workflows/publish_to_greasyfork.yml | |
secrets: inherit |