Skip to content

Commit 0f6e63f

Browse files
authored
chore(workflow) added release draft, updated release audit, & cleanup CI (#161)
1 parent bc87c09 commit 0f6e63f

8 files changed

Lines changed: 194 additions & 6 deletions

File tree

.asf-release/.gitkeep

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# Licensed to the Apache Software Foundation (ASF) under one
2+
# or more contributor license agreements. See the NOTICE file
3+
# distributed with this work for additional information
4+
# regarding copyright ownership. The ASF licenses this file
5+
# to you under the Apache License, Version 2.0 (the
6+
# "License"); you may not use this file except in compliance
7+
# with the License. You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing,
12+
# software distributed under the License is distributed on an
13+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
# KIND, either express or implied. See the License for the
15+
# specific language governing permissions and limitations
16+
# under the License.
17+
18+
# ---
19+
# This directory is used as apart of the release process.
20+
# Package tarballs will be generated in stored temporarily
21+
# within this directory and should not be commited to repo.
22+
# ---

.github/workflows/ci.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,8 +74,7 @@ jobs:
7474

7575
- uses: github/codeql-action/analyze@9e0d7b8d25671d64c341c19c0152d693099fb5ba # v4.35.5
7676

77-
# v4.6.0
78-
- uses: codecov/codecov-action@b9fd7d16f6d7d1b5d2bec1a2887e65ceed900238
77+
- uses: codecov/codecov-action@b9fd7d16f6d7d1b5d2bec1a2887e65ceed900238 # v4.6.0
7978
if: success()
8079
with:
8180
name: ${{ runner.os }} node.js ${{ matrix.node.version }}
Lines changed: 155 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,155 @@
1+
# Licensed to the Apache Software Foundation (ASF) under one
2+
# or more contributor license agreements. See the NOTICE file
3+
# distributed with this work for additional information
4+
# regarding copyright ownership. The ASF licenses this file
5+
# to you under the Apache License, Version 2.0 (the
6+
# "License"); you may not use this file except in compliance
7+
# with the License. You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing,
12+
# software distributed under the License is distributed on an
13+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
# KIND, either express or implied. See the License for the
15+
# specific language governing permissions and limitations
16+
# under the License.
17+
18+
name: Draft Release
19+
20+
on:
21+
push:
22+
tags:
23+
- 'draft/**'
24+
25+
permissions:
26+
contents: read
27+
id-token: write
28+
29+
jobs:
30+
upload-to-atr:
31+
runs-on: ubuntu-latest
32+
33+
steps:
34+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
35+
with:
36+
persist-credentials: false
37+
fetch-depth: 1
38+
39+
- uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
40+
with:
41+
node-version: 24
42+
package-manager-cache: false
43+
cache: ''
44+
45+
- name: Setup environment variables
46+
run: |
47+
REPO_NAME="${GITHUB_REPOSITORY#*/}"
48+
TAG_NAME="${GITHUB_REF#refs/tags/}"
49+
TARGET_RELEASE_VERSION="${TAG_NAME#draft/}"
50+
SRC_PACKAGE_NAME=${REPO_NAME}-source-${TARGET_RELEASE_VERSION}
51+
SRC_PACKAGE_TAR=${SRC_PACKAGE_NAME}.tar
52+
SRC_PACKAGE_TAR_GZ=${SRC_PACKAGE_NAME}.tar.gz
53+
SRC_PACKAGE_ZIP=${SRC_PACKAGE_NAME}.zip
54+
NPM_PACKAGE_NAME=${REPO_NAME}-npm-${TARGET_RELEASE_VERSION}
55+
56+
echo "REPO_NAME=$REPO_NAME" >> $GITHUB_ENV
57+
echo "TAG_NAME=$TAG_NAME" >> $GITHUB_ENV
58+
echo "TARGET_RELEASE_VERSION=$TARGET_RELEASE_VERSION" >> $GITHUB_ENV
59+
echo "SRC_PACKAGE_NAME=$SRC_PACKAGE_NAME" >> $GITHUB_ENV
60+
echo "SRC_PACKAGE_TAR=$SRC_PACKAGE_TAR" >> $GITHUB_ENV
61+
echo "SRC_PACKAGE_TAR_GZ=$SRC_PACKAGE_TAR_GZ" >> $GITHUB_ENV
62+
echo "SRC_PACKAGE_ZIP=$SRC_PACKAGE_ZIP" >> $GITHUB_ENV
63+
echo "NPM_PACKAGE_NAME=$NPM_PACKAGE_NAME" >> $GITHUB_ENV
64+
65+
echo "REPO_NAME=$REPO_NAME"
66+
echo "TAG_NAME=$TAG_NAME"
67+
echo "TARGET_RELEASE_VERSION=$TARGET_RELEASE_VERSION"
68+
echo "SRC_PACKAGE_NAME=$SRC_PACKAGE_NAME"
69+
echo "SRC_PACKAGE_TAR=$SRC_PACKAGE_TAR"
70+
echo "SRC_PACKAGE_TAR_GZ=$SRC_PACKAGE_TAR_GZ"
71+
echo "SRC_PACKAGE_ZIP=$SRC_PACKAGE_ZIP"
72+
echo "NPM_PACKAGE_NAME=$NPM_PACKAGE_NAME"
73+
74+
- name: Verify Target Release Version
75+
run: |
76+
PACKAGE_VERSION=$(jq -r '.version' package.json)
77+
if [ "$PACKAGE_VERSION" != "$TARGET_RELEASE_VERSION" ]; then
78+
echo "Mismatch version detected between tag version ($TARGET_RELEASE_VERSION) and package version ($PACKAGE_VERSION)"
79+
exit 1
80+
fi
81+
82+
if [ -f "plugin.xml" ]; then
83+
PLUGIN_VERSION=$(yq -p=xml -o=json '.plugin.+@version' plugin.xml | jq -r .)
84+
if [ "$PLUGIN_VERSION" != "$TARGET_RELEASE_VERSION" ]; then
85+
echo "Mismatch version detected between tag version ($TARGET_RELEASE_VERSION) and plugin version ($PLUGIN_VERSION)"
86+
exit 1
87+
fi
88+
fi
89+
90+
- name: Generate "tgz" npm convenience package
91+
run: |-
92+
npm ci
93+
NPM_PKG_NAME=$(npm pack --json | jq -r '.[0].filename')
94+
mv ./.asf-release/$NPM_PKG_NAME ./.asf-release/${NPM_PACKAGE_NAME}.tgz
95+
env:
96+
TZ: UTC
97+
98+
- name: Generate "tar" source package
99+
run: |-
100+
export SRC_LAST_COMMIT_EPOCH=$(git log -1 --format=%ct "$TAG_NAME")
101+
102+
git archive \
103+
--prefix=$SRC_PACKAGE_NAME/ \
104+
--mtime=$SRC_LAST_COMMIT_EPOCH \
105+
-o ./.asf-release/${SRC_PACKAGE_TAR} \
106+
$TAG_NAME
107+
env:
108+
TZ: UTC
109+
110+
- name: Generate "tar.gz" source archive
111+
working-directory: ./.asf-release
112+
run: |-
113+
gzip -n -9 -c "$SRC_PACKAGE_TAR" > "$SRC_PACKAGE_TAR_GZ"
114+
env:
115+
TZ: UTC
116+
117+
- name: Generate "zip" source archive
118+
working-directory: ./.asf-release
119+
run: |-
120+
export ASF_RELEASE_DIR=$(pwd)
121+
export TMP_DIR=$(mktemp -d)
122+
123+
tar -xf "$SRC_PACKAGE_TAR" -C "$TMP_DIR"
124+
(
125+
cd "$TMP_DIR"
126+
find . -type f | LC_ALL=C sort | zip -X -q "$ASF_RELEASE_DIR/$SRC_PACKAGE_ZIP" -@
127+
)
128+
rm -rf $TMP_DIR
129+
env:
130+
TZ: UTC
131+
132+
- name: Cleanup Process
133+
working-directory: ./.asf-release
134+
run: |-
135+
rm -rf $SRC_PACKAGE_TAR
136+
rm -rf .gitkeep
137+
138+
- name: Create Sign and Checksum
139+
working-directory: .asf-release
140+
run: |-
141+
for f in *.tar.gz *.tgz *.zip; do
142+
[ -e "$f" ] || continue
143+
echo "$CORDOVA_GPG_SECRET_KEY" | gpg --batch --import --import-options import-show
144+
gpg --armor --detach-sign "$f"
145+
sha512sum "$f" > "${f}.sha512"
146+
done
147+
env:
148+
CORDOVA_GPG_SECRET_KEY: ${{ secrets.CORDOVA_GPG_SECRET_KEY }}
149+
150+
- name: Upload to Apache Trusted Release (ATR)
151+
uses: apache/tooling-actions/upload-to-atr@f5f4c0e7ddfbde6b1f8288cef36324c6def68051
152+
with:
153+
project: ${{ env.REPO_NAME }}
154+
version: ${{ env.TARGET_RELEASE_VERSION }}
155+
src: .asf-release

.github/workflows/release-audit.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,8 @@ jobs:
3939
persist-credentials: false
4040
fetch-depth: 1
4141

42-
# Check license headers (v3.0.0)
43-
- uses: erisu/apache-rat-action@30c94d10ed21e6f6fd5590dc5c158f58cae7a0dd
42+
# Check license headers
43+
- uses: erisu/apache-rat-action@30c94d10ed21e6f6fd5590dc5c158f58cae7a0dd # v3.0.0
4444

4545
# Setup environment with node
4646
- uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
@@ -51,8 +51,8 @@ jobs:
5151
- name: npm install packages
5252
run: npm ci
5353

54-
# Check node package licenses (v2.1.0)
55-
- uses: erisu/license-checker-action@04511f4c052b5773f11e1c65b42cda88235c62ae
54+
# Check node package licenses
55+
- uses: erisu/license-checker-action@04511f4c052b5773f11e1c65b42cda88235c62ae # v2.1.0
5656
with:
5757
license-config: 'licence_checker.yml'
5858
include-asf-category-a: true

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,3 +21,7 @@ npm-debug.log
2121
coverage
2222
.nyc_output
2323
lcov.info
24+
25+
# ASF release workspace
26+
.asf-release/
27+
!.asf-release/.gitkeep

.npmignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,3 +20,6 @@ coverage
2020
test
2121
eslint.config.js
2222
licence_checker.yml
23+
24+
# ASF release workspace
25+
.asf-release/

.npmrc

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,3 +16,8 @@
1616
# under the License.
1717

1818
registry=https://registry.npmjs.org
19+
20+
# ASF release settings
21+
git-tag-version=false
22+
preid=dev
23+
pack-destination=./.asf-release
File renamed without changes.

0 commit comments

Comments
 (0)