Skip to content

Commit 45254f1

Browse files
authored
OPS-3: Github action to deploy to staging (#7)
1 parent 6027a7f commit 45254f1

File tree

4 files changed

+29
-10
lines changed

4 files changed

+29
-10
lines changed
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
name: Deploy to Staging
2+
3+
on:
4+
push:
5+
tags:
6+
- staging-*
7+
8+
9+
jobs:
10+
deploy-to-staging:
11+
name: Simulate deployment to staging
12+
runs-on: ubuntu-latest
13+
steps:
14+
- uses: actions/checkout@v4
15+
with:
16+
ref: ${{ github.ref_name }} # Checks out the tag that triggered the workflow
17+
18+
- name: Tag repo
19+
# We do not have a real repo so we just tag the git repo and then the
20+
# simulate-environment-reporting-staging.yml will start reporting that
21+
# this environment is now running.
22+
run: |
23+
if git rev-parse running-staging >/dev/null 2>&1; then \
24+
git tag -d running-staging; \
25+
git push --delete origin running-staging; \
26+
fi
27+
git tag running-staging
28+
git push origin running-staging

.github/workflows/simulate-environment-reporting-staging.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ jobs:
2424
steps:
2525
- uses: actions/checkout@v4
2626
with:
27-
ref: staging-running
27+
ref: running-staging
2828

2929
- name: Setup Kosli cli
3030
uses: kosli-dev/setup-cli-action@v2

Makefile

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,3 @@ deploy_to_staging:
77
@git status --untracked-files=no | grep --silent "Your branch is up to date" || (echo "ERROR: your branch is NOT up to date with remote" && exit 1)
88
git tag staging-${TIMESTAMP}
99
git push origin staging-${TIMESTAMP} $(args)
10-
11-
# The rest is a little extra for simulating the staging environment.
12-
@if git rev-parse staging-running >/dev/null 2>&1; then \
13-
git tag -d staging-running; \
14-
git push --delete origin staging-running; \
15-
fi
16-
git tag staging-running
17-
git push origin staging-running

apps/frontend/frontend-content.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,3 @@ This is just a file to test out that changes to front-end source code
22
can trigger a build, reporting to Kosli and Jira
33

44
counter=4
5-

0 commit comments

Comments
 (0)