Skip to content

Commit e7715e1

Browse files
committed
ci: Add deployment step
1 parent 92af647 commit e7715e1

File tree

3 files changed

+38
-37
lines changed

3 files changed

+38
-37
lines changed

.github/workflows/main.yml

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,4 +112,34 @@ jobs:
112112
GITHUB_TOKEN: ${{ secrets.NUMARY_GITHUB_TOKEN }}
113113
SPEAKEASY_API_KEY: ${{ secrets.SPEAKEASY_API_KEY }}
114114
FURY_TOKEN: ${{ secrets.FURY_TOKEN }}
115-
GORELEASER_KEY: ${{ secrets.GORELEASER_KEY }}
115+
GORELEASER_KEY: ${{ secrets.GORELEASER_KEY }}
116+
117+
Deploy:
118+
runs-on: "ubuntu-latest"
119+
if: github.ref == 'refs/heads/main'
120+
environment: staging
121+
needs:
122+
- GoReleaser
123+
- Tests
124+
steps:
125+
- uses: earthly/actions-setup@v1
126+
with:
127+
github-token: ${{ secrets.GITHUB_TOKEN }}
128+
version: "latest"
129+
- uses: 'actions/checkout@v4'
130+
with:
131+
fetch-depth: 0
132+
- name: Tailscale
133+
uses: tailscale/github-action@v2
134+
with:
135+
oauth-client-id: ${{ secrets.TS_OAUTH_CLIENT_ID }}
136+
oauth-secret: ${{ secrets.TS_OAUTH_SECRET }}
137+
tags: tag:ci
138+
- name: "Deploy in staging"
139+
env:
140+
TAG: ${{ github.sha }}
141+
run: >
142+
earthly
143+
--no-output
144+
+deploy-staging
145+
--TAG=$TAG

.github/workflows/releases.yml

Lines changed: 6 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -7,43 +7,9 @@ permissions:
77
contents: write
88

99
jobs:
10-
Dirty:
11-
runs-on: "ubuntu-latest"
12-
steps:
13-
- uses: 'actions/checkout@v4'
14-
with:
15-
fetch-depth: 0
16-
- name: Setup Env
17-
uses: ./.github/actions/env
18-
with:
19-
token: ${{ secrets.NUMARY_GITHUB_TOKEN }}
20-
- run: >
21-
earthly
22-
--allow-privileged
23-
--secret SPEAKEASY_API_KEY=$SPEAKEASY_API_KEY
24-
${{ contains(github.event.pull_request.labels.*.name, 'no-cache') && '--no-cache' || '' }}
25-
+pre-commit
26-
env:
27-
SPEAKEASY_API_KEY: ${{ secrets.SPEAKEASY_API_KEY }}
28-
- name: Get changed files
29-
id: changed-files
30-
run: |
31-
hasChanged=$(git status --porcelain)
32-
if (( $(echo ${#hasChanged}) != 0 )); then
33-
git status
34-
echo "There are changes in the repository"
35-
exit 1
36-
fi
37-
3810
GoReleaser:
3911
runs-on: "ubuntu-latest"
40-
needs:
41-
- Dirty
4212
steps:
43-
- uses: earthly/actions-setup@v1
44-
with:
45-
github-token: ${{ secrets.GITHUB_TOKEN }}
46-
version: "latest"
4713
- uses: 'actions/checkout@v4'
4814
with:
4915
fetch-depth: 0
@@ -71,4 +37,9 @@ jobs:
7137
GITHUB_TOKEN: ${{ secrets.NUMARY_GITHUB_TOKEN }}
7238
SPEAKEASY_API_KEY: ${{ secrets.SPEAKEASY_API_KEY }}
7339
FURY_TOKEN: ${{ secrets.FURY_TOKEN }}
74-
GORELEASER_KEY: ${{ secrets.GORELEASER_KEY }}
40+
GORELEASER_KEY: ${{ secrets.GORELEASER_KEY }}
41+
- name: Add the OpenAPI file to the release assets
42+
run: >
43+
gh release upload ${{github.ref_name}} ./openapi.yaml#openapi.yaml
44+
env:
45+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

Earthfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
VERSION 0.8
22

3-
IMPORT github.com/formancehq/earthly:tags/v0.16.0 AS core
3+
IMPORT github.com/formancehq/earthly:tags/v0.16.1 AS core
44

55

66

0 commit comments

Comments
 (0)