-
Notifications
You must be signed in to change notification settings - Fork 104
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
Changes from 33 commits
Commits
Show all changes
35 commits
Select commit
Hold shift + click to select a range
ba35083
Test Release action
aggarw13 f6acd88
Move release workflow into a separate file;
aggarw13 40dedab
Give release workflow a name
aggarw13 e255c45
Remove CI workflow
aggarw13 f531de7
Minor change in release asset workflow
aggarw13 5d82361
Move name after "on"
aggarw13 300289d
Change name of workflow
aggarw13 7a12714
Remove new line
aggarw13 ca03990
Merge remote-tracking branch 'origin/main' into test/release-creation…
aggarw13 d7123c1
Add tagging and zipping capability to release workflow
aggarw13 c138947
Fix syntax
aggarw13 d981751
Minor change to trigger workflow
aggarw13 b54d1e4
Shorten workflow name
aggarw13 83565b9
Rename file to attempt addition of workflow
aggarw13 8ffdb25
Update release workflow file
aggarw13 a29438b
Update workflow
aggarw13 45d1fa1
Configure git identity
aggarw13 079b6e2
Rectify name of ZIP file to use version number
aggarw13 44ef78c
Make jobs run sequentially, and update ZIP validation check to run un…
aggarw13 e0caee6
Attempt to fix unit test run
aggarw13 79925d1
Add job to upload release with asset
aggarw13 146fbd4
Fix syntax
aggarw13 aaea937
Another syntax fix
aggarw13 03c205a
Attempt to fix upload release action
aggarw13 456cd06
Debug release asset upload issue
aggarw13 f883e61
Uncomment out steps
aggarw13 bc56c82
Modify download artifact to download in the current working directory
aggarw13 44d4d11
Remove permission check from Release step
aggarw13 a0e545e
Remove logic to mask diff issue of ZIP file
aggarw13 be175c6
Checkout recursively for creating ZIP
aggarw13 5249951
Add step of cloning disabled submodules with "--checkout" flah
aggarw13 2fc29e5
Remove trailing whitespaces
aggarw13 27da803
hygiene: Remove test-release.yml
aggarw13 d6046ce
Remove ".github" folder from ZIP package
aggarw13 f96ca00
Merge branch 'main' into test/release-workflow
aggarw13 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" | ||
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 | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
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*"