Skip to content

Commit b522887

Browse files
jasonpcarrollczjaso
andauthored
Update release workflow to match standard format (#186)
Co-authored-by: czjaso <czjaso@amazon.com>
1 parent 9499e4f commit b522887

File tree

1 file changed

+15
-151
lines changed

1 file changed

+15
-151
lines changed

.github/workflows/release.yml

Lines changed: 15 additions & 151 deletions
Original file line numberDiff line numberDiff line change
@@ -1,164 +1,28 @@
11
name: Release automation
22

3+
permissions:
4+
contents: write
5+
pull-requests: write
6+
37
on:
48
workflow_dispatch:
59
inputs:
6-
commit_id:
7-
description: 'Commit ID to tag and create a release for'
8-
required: true
910
version_number:
1011
description: 'Release Version Number (Eg, v1.0.0)'
1112
required: true
13+
branch:
14+
description: 'Branch to release from'
15+
required: false
16+
default: 'main'
1217

1318
jobs:
14-
tag-commit:
15-
name: Tag commit
16-
runs-on: ubuntu-latest
17-
steps:
18-
- name: Checkout code
19-
uses: actions/checkout@v4
20-
with:
21-
ref: ${{ github.event.inputs.commit_id }}
22-
- name: Configure git identity
23-
run: |
24-
git config --global user.name ${{ github.actor }}
25-
git config --global user.email ${{ github.actor }}@users.noreply.github.com
26-
- name: create a new branch that references commit id
27-
env:
28-
VERSION_NUMBER: ${{ github.event.inputs.version_number }}
29-
COMMIT_ID: ${{ github.event.inputs.commit_id }}
30-
run: git checkout -b "$VERSION_NUMBER" "$COMMIT_ID"
31-
- name: Generate SBOM
32-
uses: FreeRTOS/CI-CD-Github-Actions/sbom-generator@main
33-
with:
34-
repo_path: ./
35-
source_path: ./source
36-
- name: commit SBOM file
37-
env:
38-
VERSION_NUMBER: ${{ github.event.inputs.version_number }}
39-
run: |
40-
git add .
41-
git commit -m 'Update SBOM'
42-
git push -u origin "$VERSION_NUMBER"
43-
- name: Tag Commit and Push to remote
44-
env:
45-
VERSION_NUMBER: ${{ github.event.inputs.version_number }}
46-
run: |
47-
git tag "$VERSION_NUMBER" -a -m "coreJSON Library $VERSION_NUMBER"
48-
git push origin --tags
49-
- name: Verify tag on remote
50-
env:
51-
VERSION_NUMBER: ${{ github.event.inputs.version_number }}
52-
COMMIT_ID: ${{ github.event.inputs.commit_id }}
53-
run: |
54-
git tag -d "$VERSION_NUMBER"
55-
git remote update
56-
git checkout tags/"$VERSION_NUMBER"
57-
git diff "$COMMIT_ID" tags/"$VERSION_NUMBER"
58-
create-zip:
59-
needs: tag-commit
60-
name: Create ZIP and verify package for release asset.
61-
runs-on: ubuntu-latest
62-
steps:
63-
- name: Install ZIP tools
64-
run: sudo apt-get install zip unzip
65-
- name: Checkout code
66-
uses: actions/checkout@v4
67-
with:
68-
ref: ${{ github.event.inputs.commit_id }}
69-
path: coreJSON
70-
submodules: recursive
71-
- name: Checkout disabled submodules
72-
run: |
73-
cd coreJSON
74-
git submodule update --init --checkout --recursive
75-
- name: Create ZIP
76-
env:
77-
VERSION_NUMBER: ${{ github.event.inputs.version_number }}
78-
run: |
79-
zip -r coreJSON-"$VERSION_NUMBER".zip coreJSON -x "*.git*"
80-
ls ./
81-
- name: Validate created ZIP
82-
env:
83-
VERSION_NUMBER: ${{ github.event.inputs.version_number }}
84-
run: |
85-
mkdir zip-check
86-
mv coreJSON-"$VERSION_NUMBER".zip zip-check
87-
cd zip-check
88-
unzip coreJSON-"$VERSION_NUMBER".zip -d coreJSON-"$VERSION_NUMBER"
89-
ls coreJSON-"$VERSION_NUMBER"
90-
diff -r -x "*.git*" coreJSON-"$VERSION_NUMBER"/coreJSON/ ../coreJSON/
91-
cd ../
92-
- name: Build
93-
env:
94-
VERSION_NUMBER: ${{ github.event.inputs.version_number }}
95-
run: |
96-
cd zip-check/coreJSON-"$VERSION_NUMBER"/coreJSON
97-
sudo apt-get install -y lcov
98-
cmake -S test -B build/ \
99-
-G "Unix Makefiles" \
100-
-DCMAKE_BUILD_TYPE=Debug \
101-
-DBUILD_CLONE_SUBMODULES=ON \
102-
-DCMAKE_C_FLAGS='--coverage -Wall -Wextra -Werror'
103-
make -C build/ all
104-
- name: Test
105-
env:
106-
VERSION_NUMBER: ${{ github.event.inputs.version_number }}
107-
run: |
108-
cd zip-check/coreJSON-"$VERSION_NUMBER"/coreJSON/build/
109-
ctest -E system --output-on-failure
110-
cd ..
111-
- name: Create artifact of ZIP
112-
uses: actions/upload-artifact@v4
113-
with:
114-
name: coreJSON-${{ github.event.inputs.version_number }}.zip
115-
path: zip-check/coreJSON-${{ github.event.inputs.version_number }}.zip
116-
deploy-doxygen:
117-
needs: tag-commit
118-
name: Deploy doxygen documentation
119-
runs-on: ubuntu-latest
120-
steps:
121-
- name: Doxygen generation
122-
uses: FreeRTOS/CI-CD-Github-Actions/doxygen-generation@main
123-
with:
124-
ref: ${{ github.event.inputs.version_number }}
125-
add_release: "true"
126-
create-release:
127-
permissions:
128-
id-token: write
129-
needs:
130-
- create-zip
131-
- deploy-doxygen
132-
name: Create Release and Upload Release Asset
19+
release:
20+
name: Create Release
13321
runs-on: ubuntu-latest
13422
steps:
135-
- name: Create Release
136-
id: create_release
137-
uses: actions/create-release@v1
138-
env:
139-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
140-
with:
141-
tag_name: ${{ github.event.inputs.version_number }}
142-
release_name: ${{ github.event.inputs.version_number }}
143-
body: Release ${{ github.event.inputs.version_number }} of the coreJSON Library.
144-
draft: false
145-
prerelease: false
146-
- name: Download ZIP artifact
147-
uses: actions/download-artifact@v4
148-
with:
149-
name: coreJSON-${{ github.event.inputs.version_number }}.zip
150-
- name: Upload Release Asset
151-
id: upload-release-asset
152-
uses: actions/upload-release-asset@v1
153-
env:
154-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
155-
with:
156-
upload_url: ${{ steps.create_release.outputs.upload_url }}
157-
asset_path: ./coreJSON-${{ github.event.inputs.version_number }}.zip
158-
asset_name: coreJSON-${{ github.event.inputs.version_number }}.zip
159-
asset_content_type: application/zip
160-
- name: Backup Release Asset
161-
uses: FreeRTOS/CI-CD-Github-Actions/artifact-backup@main
23+
- name: Release
24+
uses: FreeRTOS/CI-CD-Github-Actions/release@main
16225
with:
163-
artifact_path: ./coreJSON-${{ github.event.inputs.version_number }}.zip
164-
release_tag: ${{ github.event.inputs.version_number }}
26+
version_number: ${{ github.event.inputs.version_number }}
27+
branch: ${{ github.event.inputs.branch }}
28+
github_token: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)