| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138 |
- 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: Generate SBOM and tag commit
- runs-on: ubuntu-latest
- steps:
- - name: Checkout code
- uses: actions/checkout@v3
- with:
- ref: ${{ github.event.inputs.commit_id }}
- - name: Configure git identity
- run: |
- git config --global user.name ${{ github.actor }}
- git config --global user.email ${{ github.actor }}@users.noreply.github.com
- - name: create a new branch that references commit id
- run: git checkout -b ${{ github.event.inputs.version_number }} ${{ github.event.inputs.commit_id }}
- - name: Generate SBOM
- uses: FreeRTOS/CI-CD-Github-Actions/sbom-generator@main
- with:
- repo_path: ./
- source_path: ./source
- - name: commit SBOM file
- run: |
- git add .
- git commit -m 'Update SBOM'
- git push -u origin ${{ github.event.inputs.version_number }}
- - name: Tag Commit and Push to remote
- run: |
- git tag ${{ github.event.inputs.version_number }} -a -m "coreHTTP 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 ${{ 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@v3
- with:
- ref: ${{ github.event.inputs.commit_id }}
- path: coreHTTP
- submodules: recursive
- - name: Checkout disabled submodules
- run: |
- cd coreHTTP
- git submodule update --init --checkout --recursive
- - name: Create ZIP
- run: |
- zip -r coreHTTP-${{ github.event.inputs.version_number }}.zip coreHTTP -x "*.git*"
- ls ./
- - name: Validate created ZIP
- run: |
- mkdir zip-check
- mv coreHTTP-${{ github.event.inputs.version_number }}.zip zip-check
- cd zip-check
- unzip coreHTTP-${{ github.event.inputs.version_number }}.zip -d coreHTTP-${{ github.event.inputs.version_number }}
- ls coreHTTP-${{ github.event.inputs.version_number }}
- diff -r -x "*.git*" coreHTTP-${{ github.event.inputs.version_number }}/coreHTTP/ ../coreHTTP/
- cd ../
- - name: Build
- run: |
- cd zip-check/coreHTTP-${{ github.event.inputs.version_number }}/coreHTTP
- sudo apt-get install -y lcov
- cmake -S test -B build/ \
- -G "Unix Makefiles" \
- -DCMAKE_BUILD_TYPE=Debug \
- -DCMAKE_C_FLAGS='--coverage -Wall -Wextra -DNDEBUG'
- make -C build/ all
- - name: Test
- run: |
- cd zip-check/coreHTTP-${{ github.event.inputs.version_number }}/coreHTTP/build/
- ctest -E system --output-on-failure
- cd ..
- - name: Create artifact of ZIP
- uses: actions/upload-artifact@v2
- with:
- name: coreHTTP-${{ github.event.inputs.version_number }}.zip
- path: zip-check/coreHTTP-${{ github.event.inputs.version_number }}.zip
- deploy-doxygen:
- needs: tag-commit
- name: Deploy doxygen documentation
- runs-on: ubuntu-latest
- steps:
- - name: Doxygen generation
- uses: FreeRTOS/CI-CD-Github-Actions/doxygen-generation@main
- with:
- ref: ${{ github.event.inputs.version_number }}
- add_release: "true"
- create-release:
- needs:
- - create-zip
- - deploy-doxygen
- 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 coreHTTP Library.
- draft: false
- prerelease: false
- - name: Download ZIP artifact
- uses: actions/download-artifact@v2
- with:
- name: coreHTTP-${{ 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: ./coreHTTP-${{ github.event.inputs.version_number }}.zip
- asset_name: coreHTTP-${{ github.event.inputs.version_number }}.zip
- asset_content_type: application/zip
|