-
Notifications
You must be signed in to change notification settings - Fork 9
44 lines (39 loc) · 1.69 KB
/
push-on-merge-staging.yaml
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
name: "Push staging to Windmill workspace"
on:
workflow_dispatch:
push:
branches:
- "staging"
# if the windmill workspace is persisted in a subfolder of this repos, you can add the following to avoid pushing to windmill when there's no change
# paths:
# - wm/**
env:
WMILL_URL: https://app.windmill.dev/
WMILL_WORKSPACE: github-sync-example-staging
jobs:
sync:
environment: windmill
runs-on: "ubuntu-latest"
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup Deno
uses: denoland/setup-deno@v1
with:
deno-version: vx.x.x
# We check the commit to make sure it doesn't start with [WM] which commits coming from Windmill Git Sync do.\
# If that's the case, then we stop the workflow as we want to avoid overwriting changes that are out-of-sync
# (for instance if one were to deploy in quick succession)
- name: Check commit message
id: check_message
run: |
COMMIT_MESSAGE="${{ github.event.head_commit.message }}"
if [[ "$COMMIT_MESSAGE" =~ ^\[WM\] ]]; then
echo "Commit message starts with '[WM]', skipping push to Windmill to avoid overwriting deploy that immediately follows it"
echo "skip=skip" >> $GITHUB_OUTPUT
fi
- name: Push changes
if: steps.check_message.outputs.skip != 'skip'
run: |
deno run -A https://deno.land/x/wmill@v1.333.4/main.ts workspace add __automation ${{ env.WMILL_WORKSPACE }} ${{ env.WMILL_URL }} --token ${{ secrets.WMILL_TOKEN }}
deno run -A https://deno.land/x/wmill@v1.333.4/main.ts sync push --yes --raw --skip-variables --skip-secrets --skip-resources