forked from artynova/hexdummy
-
Notifications
You must be signed in to change notification settings - Fork 5
87 lines (77 loc) · 2.49 KB
/
examples.yml
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
name: Deploy example projects
on:
push:
branches: main
jobs:
build:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
mappings:
- mojmap
- yarn
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: object-Object/ci/setup@v0
with:
python-version: "3.11"
python-packages: nox
- name: Copy template
run: nox --keywords ${{ matrix.mappings }} --tags setup
- name: Prepare example project for upload
working-directory: .ctt/${{ matrix.mappings }}
run: |
rm -rf .git
mv .github .github_disabled
echo "This directory would be called `.github` in a real project, but it's renamed here to prevent the generated workflows from actually running." >> .github_disabled/README.md
- name: Upload example project
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.mappings }}
path: .ctt/${{ matrix.mappings }}/
upload:
needs: build
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
mappings:
- mojmap
- yarn
concurrency:
group: branch/example/${{ matrix.mappings }}
env:
TARGET_BRANCH: example/${{ matrix.mappings }}
environment:
name: example-projects
url: https://github.com/FallingColors/hexdummy/tree/${{ env.TARGET_BRANCH }}
steps:
# https://github.com/orgs/community/discussions/25305#discussioncomment-8256560
- uses: actions/create-github-app-token@v1
id: token
with:
app-id: ${{ vars.DEPLOYMENT_APP_ID }}
private-key: ${{ secrets.DEPLOYMENT_PRIVATE_KEY }}
- uses: actions/checkout@v4
with:
fetch-depth: 0
ref: ${{ env.TARGET_BRANCH }}
token: ${{ steps.token.outputs.token }}
- name: Download example project
uses: actions/download-artifact@v4
with:
name: ${{ matrix.mappings }}
# https://github.com/orgs/community/discussions/26560#discussioncomment-3531273
- name: Set Git user
run: |
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
- name: Deploy example project
run: |
SHORT_SHA=`echo ${{ github.sha }} | cut -c1-10`
git add .
git commit -m "Deploy ${{ env.TARGET_BRANCH }} from ${SHORT_SHA}"
git push