Skip to content

Commit

Permalink
chore(ci): Separate release stage to only run on main
Browse files Browse the repository at this point in the history
  • Loading branch information
jeroen-plug committed Mar 18, 2021
1 parent 7be943c commit 14c4430
Showing 1 changed file with 25 additions and 1 deletion.
26 changes: 25 additions & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ on: [push, pull_request]
jobs:
build-test-and-release:
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v2
Expand Down Expand Up @@ -33,10 +32,35 @@ jobs:
- name: Test
run: npm run test
- name: SonarCloud Scan
if: ${{ github.event_name == 'push' }}
uses: sonarsource/sonarcloud-github-action@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
release:
needs: build-and-test
runs-on: ubuntu-latest
environment: production
if: github.ref == 'refs/heads/main'
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Setup Node.js
uses: actions/setup-node@v1
with:
node-version: 12.x
- name: Setup npm cache
id: npm-cache
run: |
echo "::set-output name=dir::$(npm config get cache)"
- uses: actions/cache@v2
with:
path: ${{ steps.npm-cache.outputs.dir }}
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-
- name: Install dependencies
run: npm ci
- name: Release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Expand Down

0 comments on commit 14c4430

Please sign in to comment.