diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 0000000..5cfc150 --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,27 @@ +name: Publish +on: + repository_dispatch: + types: [ release-complete ] + +jobs: + publish: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Publish + run: | + echo "//registry.visualpinball.org/:_authToken=${NPM_TOKEN}" > ~/.npmrc + npm publish + env: + NPM_TOKEN: ${{ secrets.NPM_TOKEN }} + + dispatch: + runs-on: ubuntu-latest + needs: [ publish ] + steps: + - uses: peter-evans/repository-dispatch@v1 + with: + token: ${{ secrets.GH_PAT }} + event-type: publish-complete + client-payload: '{"artifacts_run_id": "${{ github.run_id }}"}' + diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..4fc115a --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,54 @@ +name: Release +on: [push, pull_request] + +jobs: + release: + runs-on: ubuntu-latest + if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }} + steps: + - uses: actions/checkout@v2 + with: + fetch-depth: 0 + lfs: true + - name: Fetch next version + id: nextVersion + uses: VisualPinball/next-version-action@v0.1.7 + with: + tagPrefix: 'v' + - name: Bump + if: ${{ steps.nextVersion.outputs.isBump == 'true' }} + run: | + npm version ${{ steps.nextVersion.outputs.nextVersion }} --no-git-tag-version + - name: Commit + id: commit + if: ${{ steps.nextVersion.outputs.isBump == 'true' }} + run: | + git config user.name "github-actions" + git config user.email "41898282+github-actions[bot]@users.noreply.github.com" + git add package.json + git commit -m "release: ${{ steps.nextVersion.outputs.nextTag }}." + git push + commitish=$(git rev-parse HEAD) + echo ::set-output name=commitish::${commitish} + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + - name: Create Release + uses: actions/create-release@v1 + with: + tag_name: ${{ steps.nextVersion.outputs.nextTag }} + release_name: ${{ steps.nextVersion.outputs.nextTag }} + prerelease: ${{ steps.nextVersion.outputs.isPrerelease }} + commitish: ${{ steps.commit.outputs.commitish }} + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + dispatch: + runs-on: ubuntu-latest + needs: [ release ] + if: github.repository == 'VisualPinball/VisualPinball.Unity.VisualScripting' && github.ref == 'refs/heads/master' && github.event_name == 'push' + steps: + - uses: peter-evans/repository-dispatch@v1 + with: + token: ${{ secrets.GH_PAT }} + event-type: release-complete + client-payload: '{"artifacts_run_id": "${{ github.run_id }}"}'