Skip to content

Commit 1d5309d

Browse files
jasonpcarrollczjaso
andauthored
Update release workflow to match standard format (#202)
Co-authored-by: czjaso <czjaso@amazon.com>
1 parent 86ef851 commit 1d5309d

File tree

1 file changed

+16
-150
lines changed

1 file changed

+16
-150
lines changed

.github/workflows/release.yml

Lines changed: 16 additions & 150 deletions
Original file line numberDiff line numberDiff line change
@@ -1,163 +1,29 @@
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: Generate SBOM and 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 "coreHTTP 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: coreHTTP
70-
submodules: recursive
71-
- name: Checkout disabled submodules
72-
run: |
73-
cd coreHTTP
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 coreHTTP-"$VERSION_NUMBER".zip coreHTTP -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 coreHTTP-"$VERSION_NUMBER".zip zip-check
87-
cd zip-check
88-
unzip coreHTTP-"$VERSION_NUMBER".zip -d coreHTTP-"$VERSION_NUMBER"
89-
ls coreHTTP-"$VERSION_NUMBER"
90-
diff -r -x "*.git*" coreHTTP-"$VERSION_NUMBER"/coreHTTP/ ../coreHTTP/
91-
cd ../
92-
- name: Build
93-
env:
94-
VERSION_NUMBER: ${{ github.event.inputs.version_number }}
95-
run: |
96-
cd zip-check/coreHTTP-"$VERSION_NUMBER"/coreHTTP
97-
sudo apt-get install -y lcov
98-
cmake -S test -B build/ \
99-
-G "Unix Makefiles" \
100-
-DCMAKE_BUILD_TYPE=Debug \
101-
-DCMAKE_C_FLAGS='--coverage -Wall -Wextra -DNDEBUG'
102-
make -C build/ all
103-
- name: Test
104-
env:
105-
VERSION_NUMBER: ${{ github.event.inputs.version_number }}
106-
run: |
107-
cd zip-check/coreHTTP-"$VERSION_NUMBER"/coreHTTP/build/
108-
ctest -E system --output-on-failure
109-
cd ..
110-
- name: Create artifact of ZIP
111-
uses: actions/upload-artifact@v4
112-
with:
113-
name: coreHTTP-${{ github.event.inputs.version_number }}.zip
114-
path: zip-check/coreHTTP-${{ github.event.inputs.version_number }}.zip
115-
deploy-doxygen:
116-
needs: tag-commit
117-
name: Deploy doxygen documentation
118-
runs-on: ubuntu-latest
119-
steps:
120-
- name: Doxygen generation
121-
uses: FreeRTOS/CI-CD-Github-Actions/doxygen-generation@main
122-
with:
123-
ref: ${{ github.event.inputs.version_number }}
124-
add_release: "true"
125-
create-release:
126-
permissions:
127-
id-token: write
128-
needs:
129-
- create-zip
130-
- deploy-doxygen
131-
name: Create Release and Upload Release Asset
19+
release:
20+
name: Create Release
13221
runs-on: ubuntu-latest
13322
steps:
134-
- name: Create Release
135-
id: create_release
136-
uses: actions/create-release@v1
137-
env:
138-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
139-
with:
140-
tag_name: ${{ github.event.inputs.version_number }}
141-
release_name: ${{ github.event.inputs.version_number }}
142-
body: Release ${{ github.event.inputs.version_number }} of the coreHTTP Library.
143-
draft: false
144-
prerelease: false
145-
- name: Download ZIP artifact
146-
uses: actions/download-artifact@v4
147-
with:
148-
name: coreHTTP-${{ github.event.inputs.version_number }}.zip
149-
- name: Upload Release Asset
150-
id: upload-release-asset
151-
uses: actions/upload-release-asset@v1
152-
env:
153-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
154-
with:
155-
upload_url: ${{ steps.create_release.outputs.upload_url }}
156-
asset_path: ./coreHTTP-${{ github.event.inputs.version_number }}.zip
157-
asset_name: coreHTTP-${{ github.event.inputs.version_number }}.zip
158-
asset_content_type: application/zip
159-
- name: Backup Release Asset
160-
uses: FreeRTOS/CI-CD-Github-Actions/artifact-backup@main
23+
- name: Release
24+
uses: FreeRTOS/CI-CD-Github-Actions/release@main
16125
with:
162-
artifact_path: ./coreHTTP-${{ github.event.inputs.version_number }}.zip
163-
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 }}
29+
run_test_command: 'sudo apt-get install -y lcov && rm -rf ../build && cmake -S ./test -B ../build -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=Debug -DBUILD_CLONE_SUBMODULES=ON -DUNITTEST=1 -DCOV_ANALYSIS=1 -DCMAKE_C_FLAGS="--coverage -Wall -Wextra -DNDEBUG" && make -C ../build all && cd ../build && ctest -E system --output-on-failure'

0 commit comments

Comments
 (0)