feat: adding permissions checks to apollo (#307) #259
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: | |
branches: [main] | |
jobs: | |
check: | |
name: 'Check if release is needed' | |
runs-on: 'ubuntu-latest' | |
outputs: | |
exists: ${{ steps.check-tag.outputs.exists }} | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: martinbeentjes/npm-get-version-action@main | |
id: get-version | |
- uses: mukunku/[email protected] | |
id: check-tag | |
with: | |
tag: v${{ steps.get-version.outputs.current-version }} | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
release: | |
name: 'Release' | |
needs: check | |
if: needs.check.outputs.exists == 'false' | |
runs-on: 'ubuntu-latest' | |
permissions: | |
contents: write | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: martinbeentjes/npm-get-version-action@main | |
id: get-version | |
- uses: actions/create-release@v1 | |
id: create-release | |
with: | |
draft: false | |
prerelease: false | |
release_name: v${{ steps.get-version.outputs.current-version}} | |
tag_name: v${{ steps.get-version.outputs.current-version}} | |
env: | |
GITHUB_TOKEN: ${{ github.token }} | |
publish: | |
runs-on: ubuntu-latest | |
needs: check | |
if: needs.check.outputs.exists == 'false' | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: 18 | |
registry-url: 'https://registry.npmjs.org' | |
- run: yarn | |
- run: yarn build | |
- run: npm publish --access public | |
env: | |
NODE_AUTH_TOKEN: '${{ secrets.NPM_TOKEN }}' |