-
Notifications
You must be signed in to change notification settings - Fork 26
102 lines (98 loc) · 2.89 KB
/
publish-deploy.yml
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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
name: publish-deploy
on:
push:
branches: [develop]
tags: [v*]
jobs:
publish-npm:
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version-file: .nvmrc
cache: npm
registry-url: "https://registry.npmjs.org"
scope: "@epfml"
- run: npm ci
- run: npm --workspace=discojs{,-node,-web} version prerelease --preid=p`date +%Y%m%d%H%M%S`
if: github.ref_type == 'branch'
- run: npm --workspace=discojs{,-node,-web} run build
- run: npm --workspace=discojs{,-node,-web} publish --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
build-webapp:
if: github.ref_type == 'branch'
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version-file: .nvmrc
cache: npm
- run: npm ci
- run: npm --workspace={discojs,discojs-web,webapp} run build
- uses: actions/upload-pages-artifact@v3
with:
path: webapp/dist
deploy-pages:
needs: build-webapp
if: github.ref_type == 'branch'
runs-on: ubuntu-latest
permissions:
pages: write
id-token: write
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- id: deployment
uses: actions/deploy-pages@v4
publish-github-container:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
outputs:
digest: ${{ steps.build.outputs.digest }}
steps:
- uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- uses: docker/metadata-action@v5
id: meta
with:
images: ghcr.io/epfml/disco
tags: |
type=semver,pattern={{version}}
type=edge
- uses: docker/build-push-action@v6
id: build
with:
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
deploy-server:
needs: [publish-github-container]
if: github.ref_type == 'branch'
runs-on: ubuntu-latest
permissions:
contents: read
id-token: write
steps:
- uses: actions/checkout@v4
- uses: google-github-actions/auth@v2
with:
project_id: disco-367212
workload_identity_provider: projects/905419434797/locations/global/workloadIdentityPools/github/providers/disco
- uses: google-github-actions/deploy-cloudrun@v2
with:
service: disco
region: europe-west6
image: europe-west6-docker.pkg.dev/disco-367212/github/epfml/disco@${{ needs.publish-github-container.outputs.digest }}