-
Notifications
You must be signed in to change notification settings - Fork 0
48 lines (44 loc) · 1.23 KB
/
push-to-deploy.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
45
46
47
48
name: Push to Deploy
on:
push:
branches:
- main
schedule:
- cron: "7 10 1 * *" # at 10:07 on the first day of every month (i.e. monthly)
workflow_dispatch:
concurrency: ${{ github.workflow }}
jobs:
build:
uses: ./.github/workflows/build.yaml
with:
artifact-name: docs
push-to-deploy:
needs: build
permissions:
contents: write
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
ref: deploy
- name: Configure github-actions git user
run: |
git config user.name github-actions
git config user.email github-actions@github.com
- name: Clean current deployment
run: git rm -rf docs
- name: Download artifact
uses: actions/download-artifact@v4
with:
name: ${{ needs.build.outputs.artifact-name }}
path: docs
- name: Re-add and commit the main folder
id: commit
continue-on-error: true # may fail if there's nothing to commit
run: |
git add docs
git commit -m "update ${{ needs.build.outputs.commit }}"
- name: Push to deploy branch
if: steps.commit.outcome == 'success'
run: |
git push origin