forked from scratchfoundation/scratch-editor
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathworkspace-template.yml
More file actions
68 lines (64 loc) · 1.89 KB
/
workspace-template.yml
File metadata and controls
68 lines (64 loc) · 1.89 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
name: "Workspace: WS_NAME"
on:
workflow_call:
workflow_dispatch:
concurrency:
group: 'WS_NAME @ ${{ github.event.pull_request.head.label || github.head_ref || github.ref }}'
permissions:
contents: write # publish a GitHub release
pages: write # deploy to GitHub Pages
issues: write # comment on released issues
pull-requests: write # comment on released pull requests
jobs:
ci-cd:
runs-on: ubuntu-latest
defaults:
run:
working-directory: "WS_LOCATION"
environment: >-
${{
(
(
(github.ref == 'refs/heads/main') ||
(github.ref == 'refs/heads/master')
) && 'production'
) ||
(
(
(github.ref == 'refs/heads/beta') ||
(github.ref == 'refs/heads/develop') ||
startsWith(github.ref, 'refs/heads/hotfix/') ||
startsWith(github.ref, 'refs/heads/release/')
) && 'staging'
) ||
''
}}
env:
SCRATCH_SHOULD_DEPLOY: ${{ vars.SCRATCH_ENV != '' }}
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
cache: 'npm'
node-version-file: '.nvmrc'
- name: Debug info
run: |
cat <<EOF
Scratch environment: ${{ vars.SCRATCH_ENV || '<none>' }}
Node version: $(node --version)
NPM version: $(npm --version)
GitHub ref: ${{ github.ref }}
GitHub head ref: ${{ github.head_ref }}
Working directory: $(pwd)
EOF
- uses: ./.github/actions/install-dependencies
- name: Build
run: npm run build
- name: Test
run: npm run test
- name: Release
if: ${{ env.SCRATCH_SHOULD_DEPLOY == 'true' }}
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: npx --no -- semantic-release