-
Notifications
You must be signed in to change notification settings - Fork 6
99 lines (91 loc) · 3.26 KB
/
release.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
name: 'Release workflow'
concurrency:
group: release
cancel-in-progress: true
on:
push:
branches:
- release/*
jobs:
call-shared-workflow:
uses: ./.github/workflows/shared-workflow.yml
deploy-staging:
needs: call-shared-workflow
runs-on: ubuntu-latest
environment: staging
steps:
- uses: actions/checkout@v3
- name: Deploy to Staging
run: |
curl -O https://cli-dl.scalingo.com/install && bash install
scalingo login --api-token ${{ secrets.SCALINGO_TOKEN }}
scalingo --app ${{ secrets.SCALINGO_APP }} --region ${{ secrets.SCALINGO_REGION }} integration-link-manual-deploy ${{ github.ref_name }}
application-version:
runs-on: ubuntu-latest
needs: deploy-staging
outputs:
applicationVersion: ${{ steps.app_version.outputs.version }}
steps:
- uses: actions/checkout@v3
with:
fetch-depth: '0'
- uses: actions/setup-node@v3
with:
node-version: 18.x
cache: 'npm'
- run: npm ci
- name: Set application version
id: app_version
run: |
GIT_BRANCH=${GITHUB_BASE_REF:-${GITHUB_REF#refs/heads/}}
BRANCH_VERSION=$(printf '%s\n' ${GIT_BRANCH//release\//})
echo "BRANCH_VERSION=${BRANCH_VERSION}"
TAG_VERSION=$(git describe --tags `git rev-list --tags --max-count=1`)
echo "TAG_VERSION=${TAG_VERSION}"
export BRANCH_VERSION="${BRANCH_VERSION}" && export TAG_VERSION="${TAG_VERSION}" && npm run version
PATCH_VERSION="$(cat .patch-version)"
APPLICATION_VERSION=${BRANCH_VERSION}.${PATCH_VERSION}
echo "version=${APPLICATION_VERSION}" >> $GITHUB_OUTPUT
deploy-production:
needs: application-version
runs-on: ubuntu-latest
environment: production
env:
APPLICATION_VERSION: ${{ needs.application-version.outputs.applicationVersion }}
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 18.x
cache: 'npm'
- run: npm ci
- name: Push tag
id: tag_version
uses: mathieudutour/[email protected]
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
default_bump: false
default_prerelease_bump: false
custom_tag: ${{ env.APPLICATION_VERSION }}
tag_prefix: ''
- name: Deploy to Production
run: |
curl -O https://cli-dl.scalingo.com/install && bash install
scalingo login --api-token ${{ secrets.SCALINGO_TOKEN }}
scalingo --app ${{ secrets.SCALINGO_APP }} --region ${{ secrets.SCALINGO_REGION }} integration-link-manual-deploy ${{ github.ref_name }}
deploy-demo:
needs: deploy-production
runs-on: ubuntu-latest
environment: demo
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 18.x
cache: 'npm'
- run: npm ci
- name: Deploy to Demo
run: |
curl -O https://cli-dl.scalingo.com/install && bash install
scalingo login --api-token ${{ secrets.SCALINGO_TOKEN }}
scalingo --app ${{ secrets.SCALINGO_APP }} --region ${{ secrets.SCALINGO_REGION }} integration-link-manual-deploy ${{ github.ref_name }}