-
Notifications
You must be signed in to change notification settings - Fork 1
99 lines (98 loc) · 3.3 KB
/
force-release.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
88
89
90
91
92
93
94
95
96
97
98
99
# ~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen".
name: force-release
on:
workflow_dispatch:
inputs:
sha:
name: sha
type: string
required: true
description: The sha of the commit to release
publish_to_go:
name: publish_to_go
type: boolean
required: true
description: Whether to publish to Go Repository
jobs:
force-release:
runs-on: ubuntu-latest
permissions:
contents: write
env:
CI: "true"
steps:
- name: Checkout
uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab
with:
ref: ${{ inputs.sha }}
fetch-depth: 0
- name: Set git config safe.directory
run: git config --global --add safe.directory $(pwd)
- name: Set git identity
run: |-
git config user.name "github-actions"
git config user.email "[email protected]"
- name: Setup Node.js
uses: actions/setup-node@64ed1c7eab4cce3362f8c340dee64e5eaeef8f7c
with:
node-version: 16.14.0
- name: Install dependencies
run: yarn install --check-files --frozen-lockfile
- name: build
run: npx projen build
- name: Backup artifact permissions
run: cd dist && getfacl -R . > permissions-backup.acl
continue-on-error: true
- name: Upload artifact
uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce
with:
name: build-artifact
path: dist
force_release_golang:
name: Publish to Github Go Repository
needs: force-release
runs-on: ubuntu-latest
permissions:
contents: read
env:
CI: "true"
steps:
- name: Setup Node.js
uses: actions/setup-node@64ed1c7eab4cce3362f8c340dee64e5eaeef8f7c
with:
node-version: 16.14.0
- name: Setup Go
uses: actions/setup-go@fac708d6674e30b6ba41289acaab6d4b75aa0753
with:
go-version: ^1.16.0
- name: Download build artifacts
uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a
with:
name: build-artifact
path: dist
- name: Restore build artifact permissions
run: cd dist && setfacl --restore=permissions-backup.acl
continue-on-error: true
- name: Prepare Repository
run: mv dist .repo
- name: Install Dependencies
run: cd .repo && yarn install --check-files --frozen-lockfile
- name: Create Artifact
run: cd .repo && npx projen package:go
- name: Setup Copywrite tool
uses: hashicorp/setup-copywrite@867a1a2a064a0626db322392806428f7dc59cb3e
- name: Copy copywrite hcl file
run: cp .repo/.copywrite.hcl .repo/dist/go/.copywrite.hcl
- name: Add headers using Copywrite tool
run: cd .repo/dist/go && copywrite headers
- name: Remove copywrite hcl file
run: rm -f .repo/dist/go/.copywrite.hcl
- name: Collect go Artifact
run: mv .repo/dist dist
- name: Release
if: ${{ inputs.publish_to_go }}
env:
GIT_USER_NAME: CDK for Terraform Team
GIT_USER_EMAIL: [email protected]
GITHUB_TOKEN: ${{ secrets.GO_GITHUB_TOKEN }}
run: npx -p publib@latest publib-golang