forked from ember-redux/ember-redux
-
Notifications
You must be signed in to change notification settings - Fork 0
106 lines (102 loc) · 3.71 KB
/
pr.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
100
101
102
103
104
105
106
"jobs":
"test-pr":
"container":
"credentials":
"password": "${{ secrets.docker_gcr_io }}"
"username": "_json_key"
"image": "eu.gcr.io/unicorn-985/docker-images_node14-with-libnss:deploy-5893c6fca68ea35a0a51e855d5a3cb7082ef39fa"
"runs-on":
- "ubuntu-latest"
"steps":
- "name": "Check out repository code"
"uses": "actions/checkout@v3"
"with":
"ref": "${{ github.event.pull_request.head.sha }}"
- "env":
"NPM_TOKEN": "${{ secrets.npm_token }}"
"name": "set gynzy npm_token"
"run": |
cat <<EOF > .npmrc
registry=https://npm.gynzy.net/
always-auth="true"
"//npm.gynzy.net/:_authToken"="${NPM_TOKEN}"
EOF
- "name": "yarn"
"run": "yarn --cache-folder .yarncache --frozen-lockfile --prefer-offline || yarn --cache-folder .yarncache --frozen-lockfile --prefer-offline"
- "name": "setup chrome"
"uses": "browser-actions/setup-chrome@latest"
- "name": "test"
"run": "./node_modules/.bin/ember test"
"timeout-minutes": 30
"yarn-publish-preview":
"container":
"image": "node:18"
"permissions":
"contents": "read"
"packages": "write"
"pull-requests": "read"
"runs-on": "ubuntu-latest"
"steps":
- "name": "Check out repository code"
"uses": "actions/checkout@v3"
"with":
"ref": "${{ github.event.pull_request.head.sha }}"
- "env":
"NPM_TOKEN": "${{ secrets.npm_token }}"
"name": "set gynzy npm_token"
"run": |
cat <<EOF > .npmrc
registry=https://npm.gynzy.net/
always-auth="true"
"//npm.gynzy.net/:_authToken"="${NPM_TOKEN}"
EOF
- "name": "yarn"
"run": "yarn --cache-folder .yarncache --frozen-lockfile --prefer-offline || yarn --cache-folder .yarncache --frozen-lockfile --prefer-offline"
- "name": "check-version-bump"
"uses": "del-systems/check-if-version-bumped@v1"
"with":
"token": "${{ github.token }}"
- "name": "build"
"run": "yarn build"
- "env":
"NPM_TOKEN": "${{ secrets.npm_token }}"
"name": "set gynzy npm_token"
"run": |
cat <<EOF > .npmrc
registry=https://npm.gynzy.net/
always-auth="true"
"//npm.gynzy.net/:_authToken"="${NPM_TOKEN}"
EOF
- "env":
"PR_NUMBER": "${{ github.event.number }}"
"name": "publish"
"run": |
bash -c 'set -xeo pipefail;
cp package.json package.json.bak;
VERSION=$(yarn version --non-interactive 2>/dev/null | grep "Current version" | grep -o -P '[0-9a-zA-Z_.-]+$' );
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_REF_NAME}" == "master" ) ]] || [[ "${GITHUB_EVENT_NAME}" == "deployment" ]]; then
echo "Setting tag/version for release/tag build.";
PUBLISHVERSION=$VERSION;
TAG="latest";
else
exit 1
fi
yarn publish --non-interactive --no-git-tag-version --tag "$TAG" --new-version "$PUBLISHVERSION";
mv package.json.bak package.json;
';
"timeout-minutes": 30
"name": "pr"
"on":
- "pull_request"