diff options
author | Tarek BOCHKATI <tarek.bouchkati@gmail.com> | 2021-03-24 21:33:36 +0100 |
---|---|---|
committer | Antonio Borneo <borneo.antonio@gmail.com> | 2021-05-22 10:05:35 +0100 |
commit | a9c004d2c8bdfa1d1a7c98fd086bfeb2a5e23e61 (patch) | |
tree | 41917a76ace8e71c8493036a49c909a81f9c8ed6 /.github | |
parent | 2d16d62ddc7d6362433468f3f104ca4b38550b55 (diff) | |
download | riscv-openocd-a9c004d2c8bdfa1d1a7c98fd086bfeb2a5e23e61.zip riscv-openocd-a9c004d2c8bdfa1d1a7c98fd086bfeb2a5e23e61.tar.gz riscv-openocd-a9c004d2c8bdfa1d1a7c98fd086bfeb2a5e23e61.tar.bz2 |
github/action: create a permanent 'latest' release
this commit extends the existing snapshot action to create a release named
'latest' with the built binaries for windows.
this 'latest' release will be updated after every push to github.
Change-Id: I75a64c598169241743add3ac9aa7a0337fbab7f2
Signed-off-by: Tarek BOCHKATI <tarek.bouchkati@gmail.com>
Reviewed-on: http://openocd.zylin.com/6127
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Diffstat (limited to '.github')
-rw-r--r-- | .github/workflows/snapshot.yml | 45 |
1 files changed, 23 insertions, 22 deletions
diff --git a/.github/workflows/snapshot.yml b/.github/workflows/snapshot.yml index 9e871de..45db72e 100644 --- a/.github/workflows/snapshot.yml +++ b/.github/workflows/snapshot.yml @@ -15,7 +15,8 @@ jobs: steps: - name: Install needed packages run: sudo apt-get install autotools-dev autoconf automake libtool pkg-config cmake texinfo texlive g++-mingw-w64-i686 - - uses: actions/checkout@v1 + - name: Checkout Code + uses: actions/checkout@v1 - run: ./bootstrap - name: Prepare libusb1 env: @@ -62,9 +63,14 @@ jobs: LIBFTDI_CONFIG: "-DCMAKE_TOOLCHAIN_FILE='${{ env.LIBFTDI_SRC }}/cmake/Toolchain-i686-w64-mingw32.cmake' -DBUILD_TESTS:BOOL=off -DFTDIPP:BOOL=off -DPYTHON_BINDINGS:BOOL=off -DEXAMPLES:BOOL=off -DDOCUMENTATION:BOOL=off -DFTDI_EEPROM:BOOL=off" CAPSTONE_CONFIG: "CAPSTONE_BUILD_CORE_ONLY=yes CAPSTONE_STATIC=yes CAPSTONE_SHARED=no" run: | - # set snapshot tag + # check if there is tag pointing at HEAD, otherwise take the HEAD SHA-1 as OPENOCD_TAG OPENOCD_TAG="`git tag --points-at HEAD`" [ -z $OPENOCD_TAG ] && OPENOCD_TAG="`git rev-parse --short HEAD`" + # check if there is tag pointing at HEAD, if so the release will have the same name as the tag, + # otherwise it will be named 'latest' + RELEASE_NAME="`git tag --points-at HEAD`" + [ -z $RELEASE_NAME ] && RELEASE_NAME="latest" + [[ $RELEASE_NAME = "latest" ]] && IS_PRE_RELEASE="true" || IS_PRE_RELEASE="false" # set env and call cross-build.sh export OPENOCD_TAG=$OPENOCD_TAG export OPENOCD_SRC=$PWD @@ -78,31 +84,26 @@ jobs: # prepare the artifact ARTIFACT="openocd-${OPENOCD_TAG}-${HOST}.tar.gz" tar -czf $ARTIFACT * - echo "ARTIFACT_NAME=$ARTIFACT" >> $GITHUB_ENV + echo "RELEASE_NAME=$RELEASE_NAME" >> $GITHUB_ENV + echo "IS_PRE_RELEASE=$IS_PRE_RELEASE" >> $GITHUB_ENV echo "ARTIFACT_PATH=$PWD/$ARTIFACT" >> $GITHUB_ENV - name: Publish OpenOCD packaged for windows - uses: actions/upload-artifact@v1 + uses: actions/upload-artifact@v2 with: - name: ${{ env.ARTIFACT_NAME }} path: ${{ env.ARTIFACT_PATH }} - - name: Create Release - id: create_release - if: startsWith(github.ref, 'refs/tags/') - uses: actions/create-release@v1.1.4 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + - name: Delete 'latest' Release + uses: dev-drprasad/delete-tag-and-release@v0.2.0 with: - tag_name: ${{ github.ref }} - release_name: ${{ github.ref }} - draft: false - prerelease: false - - name: Release OpenOCD packaged for windows - if: startsWith(github.ref, 'refs/tags/') - uses: actions/upload-release-asset@v1 + delete_release: true + tag_name: ${{ env.RELEASE_NAME }} env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + - name: Create Release + uses: ncipollo/release-action@v1 with: - upload_url: ${{ steps.create_release.outputs.upload_url }} - asset_path: ${{ env.ARTIFACT_PATH }} - asset_name: ${{ env.ARTIFACT_NAME }} - asset_content_type: application/gzip + tag: ${{ env.RELEASE_NAME }} + commit: ${{ github.sha }} + draft: false + artifacts: ${{ env.ARTIFACT_PATH }} + prerelease: ${{ env.IS_PRE_RELEASE }} + token: ${{ secrets.GITHUB_TOKEN }} |