Merge pull request #6 from RedEyeMods/updated/template/action-template #10
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: Automatic Distribution | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
check-diff: | |
runs-on: ubuntu-latest | |
if: ${{ !github.event.repository.is_template }} | |
outputs: | |
INDEX_CHANGED: ${{ steps.filter.outputs.index }} | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: dorny/paths-filter@v3 | |
id: filter | |
with: | |
base: main | |
filters: | | |
index: | |
- 'index.js' | |
release-dist: | |
runs-on: ubuntu-latest | |
needs: check-diff | |
if: ${{ needs.check-diff.outputs.INDEX_CHANGED == 'true' }} | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-node@v4 | |
- uses: crazy-max/ghaction-import-gpg@v6 | |
with: | |
gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }} | |
passphrase: ${{ secrets.GPG_SIGNING_PASSPHRASE }} | |
git_user_signingkey: true | |
git_commit_gpgsign: true | |
- uses: reecetech/[email protected] | |
id: version | |
with: | |
scheme: calver | |
- name: Add Node Modules and Push | |
env: | |
checkout_branch: v${{ steps.version.outputs.major-version }}.${{ steps.version.outputs.minor-version }}.x | |
GH_TOKEN: ${{ github.token }} | |
run: | | |
git checkout ${{ env.checkout_branch }} 2>/dev/null || git checkout -b ${{ env.checkout_branch }} | |
git merge -X theirs ${{ github.event.repository.default_branch }} | |
npm install | |
git add ./node_modules -f | |
git commit -am "Push node modules" | |
git tag ${{ steps.version.outputs.version }} | |
git push -f --set-upstream origin ${{ env.checkout_branch }} | |
git push origin tag ${{ steps.version.outputs.version }} | |
echo '🚀 Released v${{ steps.version.outputs.version }} @ ${{ github.event.repository.full_name }}/${{ env.checkout_branch }}' >> $GITHUB_STEP_SUMMARY |