Skip to content

Commit c750b50

Browse files
committed
feat(ci): revamp release workflow
1 parent 452a313 commit c750b50

File tree

2 files changed

+47
-2
lines changed

2 files changed

+47
-2
lines changed

.github/workflows/ci.yml renamed to .github/workflows/push.yml

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,17 @@ jobs:
2626
- run: npm install
2727
- run: npm run build
2828

29+
docker:
30+
runs-on: ubuntu-latest
31+
steps:
32+
- uses: actions/checkout@v2
33+
- name: Set up QEMU
34+
uses: docker/setup-qemu-action@v1
35+
- name: Set up Docker Buildx
36+
uses: docker/setup-buildx-action@v1
37+
- name: Build docker image (no push)
38+
uses: docker/build-push-action@v2
39+
2940
commitlint:
3041
runs-on: ubuntu-latest
3142
steps:
@@ -38,7 +49,7 @@ jobs:
3849

3950
release:
4051
name: Publish new release
41-
needs: [build, lint, commitlint]
52+
needs: [build, lint, docker, commitlint]
4253
if: github.ref == 'refs/heads/main' && github.event_name != 'pull_request'
4354
runs-on: ubuntu-latest
4455
steps:
@@ -50,5 +61,5 @@ jobs:
5061
node-version: 14
5162
- name: Release
5263
env:
53-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
64+
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
5465
run: npx semantic-release

.github/workflows/release.yml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
name: Release workflow
2+
3+
on:
4+
release:
5+
types: [created]
6+
7+
jobs:
8+
porter-deploy:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- name: Checkout
12+
uses: actions/checkout@v2
13+
- name: Get the tag
14+
id: get_tag
15+
run: echo ::set-output name=tag::${GITHUB_REF/refs\/tags\//}
16+
- name: Set up QEMU
17+
uses: docker/setup-qemu-action@v1
18+
- name: Set up Docker Buildx
19+
uses: docker/setup-buildx-action@v1
20+
- name: Login to Scaleway Container Registry
21+
uses: docker/login-action@v1
22+
with:
23+
registry: rg.fr-par.scw.cloud/codebench
24+
username: nologin
25+
password: ${{ secrets.SCW_SECRET_KEY }}
26+
- name: Build and push
27+
uses: docker/build-push-action@v2
28+
with:
29+
push: true
30+
tags: |
31+
rg.fr-par.scw.cloud/codebench/api:${{ steps.get_tag.outputs.tag }}
32+
rg.fr-par.scw.cloud/codebench/api:latest
33+
- name: Deploy on Porter
34+
run: curl -X POST "https://dashboard.getporter.dev/api/webhooks/deploy/${{secrets.PORTER_WEBHOOK}}?commit=${{ steps.get_tag.outputs.tag }}"

0 commit comments

Comments
 (0)