Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Automate release with GitHub Action Job #121

Merged
merged 35 commits into from
Dec 4, 2020
Merged
Changes from 33 commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
ba35083
Test Release action
aggarw13 Sep 17, 2020
f6acd88
Move release workflow into a separate file;
aggarw13 Sep 18, 2020
40dedab
Give release workflow a name
aggarw13 Sep 18, 2020
e255c45
Remove CI workflow
aggarw13 Sep 18, 2020
f531de7
Minor change in release asset workflow
aggarw13 Sep 18, 2020
5d82361
Move name after "on"
aggarw13 Sep 18, 2020
300289d
Change name of workflow
aggarw13 Sep 18, 2020
7a12714
Remove new line
aggarw13 Sep 25, 2020
ca03990
Merge remote-tracking branch 'origin/main' into test/release-creation…
aggarw13 Dec 2, 2020
d7123c1
Add tagging and zipping capability to release workflow
aggarw13 Dec 2, 2020
c138947
Fix syntax
aggarw13 Dec 2, 2020
d981751
Minor change to trigger workflow
aggarw13 Dec 2, 2020
b54d1e4
Shorten workflow name
aggarw13 Dec 2, 2020
83565b9
Rename file to attempt addition of workflow
aggarw13 Dec 2, 2020
8ffdb25
Update release workflow file
aggarw13 Dec 2, 2020
a29438b
Update workflow
aggarw13 Dec 2, 2020
45d1fa1
Configure git identity
aggarw13 Dec 3, 2020
079b6e2
Rectify name of ZIP file to use version number
aggarw13 Dec 3, 2020
44ef78c
Make jobs run sequentially, and update ZIP validation check to run un…
aggarw13 Dec 3, 2020
e0caee6
Attempt to fix unit test run
aggarw13 Dec 3, 2020
79925d1
Add job to upload release with asset
aggarw13 Dec 3, 2020
146fbd4
Fix syntax
aggarw13 Dec 3, 2020
aaea937
Another syntax fix
aggarw13 Dec 3, 2020
03c205a
Attempt to fix upload release action
aggarw13 Dec 3, 2020
456cd06
Debug release asset upload issue
aggarw13 Dec 3, 2020
f883e61
Uncomment out steps
aggarw13 Dec 3, 2020
bc56c82
Modify download artifact to download in the current working directory
aggarw13 Dec 3, 2020
44d4d11
Remove permission check from Release step
aggarw13 Dec 3, 2020
a0e545e
Remove logic to mask diff issue of ZIP file
aggarw13 Dec 3, 2020
be175c6
Checkout recursively for creating ZIP
aggarw13 Dec 3, 2020
5249951
Add step of cloning disabled submodules with "--checkout" flah
aggarw13 Dec 3, 2020
2fc29e5
Remove trailing whitespaces
aggarw13 Dec 3, 2020
27da803
hygiene: Remove test-release.yml
aggarw13 Dec 3, 2020
d6046ce
Remove ".github" folder from ZIP package
aggarw13 Dec 4, 2020
f96ca00
Merge branch 'main' into test/release-workflow
aggarw13 Dec 4, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
115 changes: 115 additions & 0 deletions .github/workflows/release-workflow.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
name: Release automation

on:
workflow_dispatch:
inputs:
commit_id:
description: 'Commit ID to tag and create a release for'
required: true
version_number:
description: 'Release Version Number (Eg, v1.0.0)'
required: true

jobs:
tag-commit:
name: Tag commit
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
with:
ref: ${{ github.event.inputs.commit_id }}
- name: Configure git identity
run: |
git config --global user.name "Release Workflow"
- name: Tag Commit and Push to remote
run: |
git tag ${{ github.event.inputs.version_number }} -a -m "coreMQTT Library ${{ github.event.inputs.version_number }}"
git push origin --tags
- name: Verify tag on remote
run: |
git tag -d ${{ github.event.inputs.version_number }}
git remote update
git checkout tags/${{ github.event.inputs.version_number }}
git diff origin/${{ github.event.inputs.commit_id }} tags/${{ github.event.inputs.version_number }}
create-zip:
needs: tag-commit
name: Create ZIP and verify package for release asset.
runs-on: ubuntu-latest
steps:
- name: Install ZIP tools
run: sudo apt-get install zip unzip
- name: Checkout code
uses: actions/checkout@v2
with:
ref: ${{ github.event.inputs.commit_id }}
path: coreMQTT
submodules: recursive
- name: Checkout disabled submodules
run: |
cd coreMQTT
git submodule update --init --checkout --recursive
- name: Create ZIP
run: |
zip -r coreMQTT-${{ github.event.inputs.version_number }}.zip coreMQTT -x "*.git"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will leave the .github folder in the zip. We were not doing that for the prior releases. I think it is better to avoid it.
The command can be modified to do that
zip -r coreMQTT-${{ github.event.inputs.version_number }}.zip coreMQTT -x "*.git*"

aggarw13 marked this conversation as resolved.
Show resolved Hide resolved
ls ./
- name: Validate created ZIP
run: |
mkdir zip-check
mv coreMQTT-${{ github.event.inputs.version_number }}.zip zip-check
cd zip-check
unzip coreMQTT-${{ github.event.inputs.version_number }}.zip -d coreMQTT-${{ github.event.inputs.version_number }}
ls coreMQTT-${{ github.event.inputs.version_number }}
diff -r -x "*.git*" coreMQTT-${{ github.event.inputs.version_number }}/coreMQTT/ ../coreMQTT/
cd ../
- name: Build
run: |
cd zip-check/coreMQTT-${{ github.event.inputs.version_number }}/coreMQTT
sudo apt-get install -y lcov
cmake -S test -B build/ \
-G "Unix Makefiles" \
-DCMAKE_BUILD_TYPE=Debug \
-DBUILD_CLONE_SUBMODULES=ON \
-DCMAKE_C_FLAGS='--coverage -Wall -Wextra -Werror -DNDEBUG'
make -C build/ all
- name: Test
run: |
cd zip-check/coreMQTT-${{ github.event.inputs.version_number }}/coreMQTT/build/
ctest -E system --output-on-failure
cd ..
- name: Create artifact of ZIP
uses: actions/upload-artifact@v2
with:
name: coreMQTT-${{ github.event.inputs.version_number }}.zip
path: zip-check/coreMQTT-${{ github.event.inputs.version_number }}.zip
create-release:
needs: create-zip
name: Create Release and Upload Release Asset
runs-on: ubuntu-latest
steps:
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.event.inputs.version_number }}
release_name: ${{ github.event.inputs.version_number }}
body: Release ${{ github.event.inputs.version_number }} of the coreMQTT Library.
draft: false
prerelease: false
- name: Download ZIP artifact
uses: actions/download-artifact@v2
with:
name: coreMQTT-${{ github.event.inputs.version_number }}.zip
- name: Upload Release Asset
id: upload-release-asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./coreMQTT-${{ github.event.inputs.version_number }}.zip
asset_name: coreMQTT-${{ github.event.inputs.version_number }}.zip
asset_content_type: application/zip