diff --git a/.github/workflows/create-prerelease.yml b/.github/workflows/create-prerelease.yml index f857c41..ba461cb 100644 --- a/.github/workflows/create-prerelease.yml +++ b/.github/workflows/create-prerelease.yml @@ -11,10 +11,14 @@ on: description: 'Delete existing pre-releases?' required: false type: boolean + tag: + description: 'If not a dev build, should we tag?' + required: false + type: string - push: - branches: - - "actions-hub" # remove before merge into main + # push: + # branches: + # - "actions-hub" # remove before merge into main jobs: build-and-release: runs-on: macos-13 @@ -45,6 +49,26 @@ jobs: hdiutil attach -mountpoint /Volumes/Packages Packages.dmg cd /Volumes/Packages sudo installer -pkg Install\ Packages.pkg -target / + - name: Tag Before Building + if: inputs.tag != '' + env: + TAG: ${{ inputs.tag }} + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + echo "Tagging the repository with ${TAG}" + git config --global user.email "actions@github.com" + git config --global user.name "GitHub Actions" + + # Ensure the tag does not already exist + if ! gh release view "${TAG}" > /dev/null 2>&1; then + git tag -a "${TAG}" -m "Release ${TAG}" + git push origin "${TAG}" + + echo "Tag ${TAG} created and pushed successfully." + else + echo "Tag ${TAG} already exists." + fi + - name: "Compile" env: ADDCOMMIT: ${{ inputs.addCommit }} @@ -111,14 +135,11 @@ jobs: set -e echo "${ADDCOMMIT}" cd ~/work/asvec/asvec/bin/packages - COMMIT=$(git rev-parse --short HEAD) VER=$(cat ../../VERSION.md) RPM_VER=$(echo ${VER} | sed 's/-/_/g') - BRANCH=$(git rev-parse --abbrev-ref HEAD) - TAG=${VER}-${COMMIT} - [ "${ADDCOMMIT}" = "false" ] && TAG=${VER} + TAG=${VER} FULLCOMMIT=$(git rev-parse HEAD) - gh release create -R github.com/aerospike/asvec --notes-file ../../RELEASE.md --prerelease --target ${FULLCOMMIT} --title "Asvec - v${TAG}" ${TAG} asvec-linux-amd64-${VER}.deb asvec-linux-amd64-${RPM_VER}.rpm asvec-linux-amd64-${VER}.zip asvec-linux-arm64-${VER}.deb asvec-linux-arm64-${RPM_VER}.rpm asvec-linux-arm64-${VER}.zip asvec-macos-${VER}.pkg asvec-macos-amd64-${VER}.zip asvec-macos-arm64-${VER}.zip asvec-windows-amd64-${VER}.zip asvec-windows-arm64-${VER}.zip + gh release create -R github.com/aerospike/asvec --notes-file ../../RELEASE.md --prerelease --target ${FULLCOMMIT} --title "Asvec - ${TAG}" ${TAG} asvec-linux-amd64-${VER}.deb asvec-linux-amd64-${RPM_VER}.rpm asvec-linux-amd64-${VER}.zip asvec-linux-arm64-${VER}.deb asvec-linux-arm64-${RPM_VER}.rpm asvec-linux-arm64-${VER}.zip asvec-macos-${VER}.pkg asvec-macos-amd64-${VER}.zip asvec-macos-arm64-${VER}.zip asvec-windows-amd64-${VER}.zip asvec-windows-arm64-${VER}.zip - name: "Delete previous pre-release" env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}