78 lines (76 loc) · 2.86 KB
/
push-go-runtime.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
# Workflows pertaining to the jsii/superchain Docker image
name: Push Jsii Runtime Go
on:
push:
branches: [main]
jobs:
push-go-runtime:
name: Build and Publish
runs-on: ubuntu-latest
steps:
- name: Check out
uses: actions/checkout@v2
- name: Set up Node 10
uses: actions/setup-node@v2.1.2
with:
node-version: '10'
- uses: actions/cache@v2
with:
path: '**/node_modules'
key: ${{ runner.os }}-modules-${{ hashFiles('**/yarn.lock') }}
- name: Install Dependencies
run: |-
# TypeScript project dependencies
yarn install --frozen-lockfile
- name: Align Versions
run: |-
./scripts/align-version.sh
- name: Build dependencies
run: |-
yarn build \
--scope codemaker \
--scope @jsii/spec \
--scope @jsii/kernel \
--scope @jsii/runtime
- name: Build
run: |-
yarn build \
--scope @jsii/go-runtime
- name: Build Repo Directory
id: build-repo-dir
working-directory: ${{ github.workspace }}/packages/@jsii/go-runtime
env:
JSII_RUNTIME_REPO_NAME: ${{ secrets.JSII_RUNTIME_REPO_NAME }}
JSII_RUNTIME_REPO_USERNAME: ${{ secrets.JSII_RUNTIME_REPO_USERNAME }}
JSII_RUNTIME_REPO_TOKEN: ${{ secrets.AUTO_APPROVE_GITHUB_TOKEN }}
run: |-
REPO_DIR=$(mktemp -d)
yarn ts-node ./build-tools/build-repo-dir.ts $REPO_DIR
echo "::set-output name=repodir::$REPO_DIR"
- name: Check for changes
id: check-for-changes
run: |-
# Change directory manually as using `working-directory` doesn't seem to support using outputs from the previous step
cd ${{ steps.build-repo-dir.outputs.repodir }}
git fetch --depth=1 --quiet origin main
git add .
# Check for modifications in tracked files
changed=$(git diff --name-only origin/main)
if [-z "$changed"]; then
echo "::set-output name=result::false"
else
echo "::set-output name=result::true"
fi
- name: Commit and Push
if: steps.check-for-changes.outputs.result == 'true'
env:
JSII_RUNTIME_REPO_NAME: ${{ secrets.JSII_RUNTIME_REPO_NAME }}
JSII_RUNTIME_REPO_USERNAME: ${{ secrets.JSII_RUNTIME_REPO_USERNAME }}
JSII_RUNTIME_REPO_TOKEN: ${{ secrets.AUTO_APPROVE_GITHUB_TOKEN }}
run: |-
MESSAGE=$(git log -1 --format=%s)
cd ${{ steps.build-repo-dir.outputs.repodir }}
git config user.name "$JSII_RUNTIME_REPO_USERNAME"
git config user.email "aws-cdk+automation@amazon.com"
git commit -m "$MESSAGE"
git push https://$JSII_RUNTIME_REPO_USERNAME:$JSII_RUNTIME_REPO_TOKEN@github.com/$JSII_RUNTIME_REPO_NAME.git main