generated from ipdxco/github-as-code
-
Notifications
You must be signed in to change notification settings - Fork 2
62 lines (60 loc) · 2.03 KB
/
upgrade_reusable.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
name: Upgrade (reusable)
on:
workflow_call:
inputs:
ref:
type: string
required: false
description: The github-mgmt-template ref to upgrade to
default: master
secrets:
GITHUB_APP_ID:
required: true
GITHUB_APP_INSTALLATION_ID:
required: true
GITHUB_APP_PEM_FILE:
required: true
jobs:
upgrade:
name: Upgrade
runs-on: ubuntu-latest
defaults:
run:
shell: bash
steps:
- name: Generate app token
id: token
uses: tibdex/github-app-token@b62528385c34dbc9f38e5f4225ac829252d1ea92 # v1.8.0
with:
app_id: ${{ secrets.GITHUB_APP_ID }}
installation_id: ${{ secrets.GITHUB_APP_INSTALLATION_ID }}
private_key: ${{ secrets.GITHUB_APP_PEM_FILE }}
- name: Checkout GitHub Management template
uses: actions/checkout@v3
with:
repository: pl-strflt/github-mgmt-template
path: github-mgmt-template
ref: ${{ github.event.inputs.ref }}
- name: Checkout GitHub Management
uses: actions/checkout@v3
with:
path: github-mgmt
token: ${{ steps.token.outputs.token }}
- name: Copy files from the template
run: |
for file in $(git ls-files ':!:github/*.yml' ':!:scripts/src/actions/fix-yaml-config.ts' ':!:terraform/*_override.tf' ':!:.github/workflows/*_reusable.yml' ':!:README.md'); do
mkdir -p "../github-mgmt/$(dirname "${file}")"
cp -f "${file}" "../github-mgmt/${file}"
done
working-directory: github-mgmt-template
- uses: ./github-mgmt-template/.github/actions/git-config-user
- run: |
git add --all
git diff-index --quiet HEAD || git commit --message="upgrade@${GITHUB_RUN_ID}"
working-directory: github-mgmt
- uses: ./github-mgmt-template/.github/actions/git-push
env:
GITHUB_TOKEN: ${{ steps.token.outputs.token }}
with:
suffix: upgrade
working-directory: github-mgmt