forked from adopted-ember-addons/ember-sortable
-
Notifications
You must be signed in to change notification settings - Fork 0
133 lines (128 loc) · 5.06 KB
/
Copy pathpublish-prod.yml
File metadata and controls
133 lines (128 loc) · 5.06 KB
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
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
# GENERATED with jsonnet - DO NOT EDIT MANUALLY
"jobs":
"pnpm-publish":
"container":
"image": "mirror.gcr.io/node:24"
"permissions":
"contents": "read"
"packages": "write"
"pull-requests": "read"
"runs-on": "ubuntu-latest"
"steps":
- "id": "check-binaries"
"name": "check for ssh/git binaries"
"run": |
if command -v git;
then
echo "gitBinaryExists=true" >> $GITHUB_OUTPUT;
echo "Git binary exists";
else
echo "Attempt to install git binary";
if command -v apk; then
echo "apk exists";
apk add git && echo "gitBinaryExists=true" >> $GITHUB_OUTPUT;
elif command -v apt; then
echo "apt exists";
apt update && apt install -y git && echo "gitBinaryExists=true" >> $GITHUB_OUTPUT;
else
echo "No package manager found, unable to install git cli binary";
echo "gitBinaryExists=false" >> $GITHUB_OUTPUT;
fi;
fi;
if command -v ssh;
then
echo "sshBinaryExists=true" >> $GITHUB_OUTPUT;
echo "SSH binary exists";
exit 0;
else
echo "Attempt to install ssh binary";
if command -v apk; then
echo "apk exists";
apk add openssh-client && echo "sshBinaryExists=true" >> $GITHUB_OUTPUT && exit 0;
elif command -v apt; then
echo "apt exists";
apt update && apt install -y openssh-client && echo "sshBinaryExists=true" >> $GITHUB_OUTPUT && exit 0;
else
echo "No package manager found, unable to install ssh cli binary";
echo "sshBinaryExists=false" >> $GITHUB_OUTPUT;
fi;
fi;
echo "sshBinaryExists=false" >> $GITHUB_OUTPUT;
- "id": "checkout-ssh-0"
"if": "${{ ( steps.check-binaries.outputs.sshBinaryExists == 'true' && steps.check-binaries.outputs.gitBinaryExists == 'true' ) }}"
"name": "Check out repository code via ssh"
"timeout-minutes": 10
"uses": "actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd"
"with":
"ref": "${{ github.sha }}"
"ssh-key": "${{ secrets.VIRKO_GITHUB_SSH_KEY }}"
"submodules": "recursive"
- "id": "checkout-https-0"
"if": "${{ ( steps.check-binaries.outputs.sshBinaryExists == 'false' || steps.check-binaries.outputs.gitBinaryExists == 'false' ) }}"
"name": "Check out repository code via https"
"timeout-minutes": 10
"uses": "actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd"
"with":
"ref": "${{ github.sha }}"
"submodules": "recursive"
- "name": "git safe directory"
"run": "command -v git && git config --global --add safe.directory '*' || true"
- "env":
"NODE_AUTH_TOKEN": "${{ secrets.VIRKO_GITHUB_PKG_READONLY }}"
"name": "set github npm_token"
"run": |
cat <<EOF > .npmrc
@gynzy:registry=https://npm.pkg.github.com
//npm.pkg.github.com/:_authToken=${NODE_AUTH_TOKEN}
public-hoist-pattern[]=@pulumi/pulumi
EOF
- "name": "Install pnpm tool"
"uses": "pnpm/action-setup@fc06bc1257f339d1d5d8b3a19a8cae5388b55320"
- "name": "Run pnpm install"
"run": "pnpm config set store-dir .pnpm-store && pnpm install --frozen-lockfile"
- "name": "build"
"run": "pnpm run build"
- "env":
"NODE_AUTH_TOKEN": "${{ secrets.GITHUB_TOKEN }}"
"name": "set github npm_token"
"run": |
cat <<EOF > .npmrc
@gynzy:registry=https://npm.pkg.github.com
//npm.pkg.github.com/:_authToken=${NODE_AUTH_TOKEN}
public-hoist-pattern[]=@pulumi/pulumi
EOF
- "env": {}
"name": "publish"
"run": |
bash -c 'set -xeo pipefail;
cp package.json package.json.bak;
VERSION=$(node -p "require(\"./package.json\").version");
if [[ ! -z "${PR_NUMBER}" ]]; then
echo "Setting tag/version for pr build.";
TAG=pr-$PR_NUMBER;
PUBLISHVERSION="$VERSION-pr$PR_NUMBER.$GITHUB_RUN_NUMBER";
elif [[ "${GITHUB_REF_TYPE}" == "tag" ]]; then
if [[ "${GITHUB_REF_NAME}" != "${VERSION}" ]]; then
echo "Tag version does not match package version. They should match. Exiting";
exit 1;
fi
echo "Setting tag/version for release/tag build.";
PUBLISHVERSION=$VERSION;
TAG="latest";
elif [[ "${GITHUB_REF_TYPE}" == "branch" && "${GITHUB_REF_NAME}" == "main" ]] || [[ "${GITHUB_EVENT_NAME}" == "deployment" ]]; then
echo "Setting tag/version for release/tag build.";
PUBLISHVERSION=$VERSION;
TAG="latest";
else
exit 1
fi
npm version --no-git-tag-version --allow-same-version "$PUBLISHVERSION";
pnpm publish --no-git-checks --tag "$TAG";
mv package.json.bak package.json;
';
"timeout-minutes": 30
"name": "publish-prod"
"on":
"push":
"branches":
- "main"