This is an automated email from Gerrit.

Tarek BOCHKATI ([email protected]) just uploaded a new patch set to 
Gerrit, which you can find at http://openocd.zylin.com/6127

-- gerrit

commit 654269ce0085b4b32f756726d9ecb2b5b663599c
Author: Tarek BOCHKATI <[email protected]>
Date:   Wed Mar 24 21:33:36 2021 +0100

    [RFC] 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 <[email protected]>

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/[email protected]
-        env:
-          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+      - name: Delete 'latest' Release
+        uses: dev-drprasad/[email protected]
         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 }}

-- 


_______________________________________________
OpenOCD-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openocd-devel

Reply via email to