From c3b705ee34a8465cf9f953e1e6b3a77e289c3f46 Mon Sep 17 00:00:00 2001 From: Sergio Rua <58211930+digiserg@users.noreply.github.com> Date: Wed, 25 Sep 2024 17:02:46 +0100 Subject: [PATCH] Adds v to version (#454) * Adds v prefix to version * Adds v prefix to version * Standard artefact name * Check for valid tag * Add version variable --- .github/workflows/check-valid-tag.yml | 20 ++++++++++++++++++++ .github/workflows/release.yml | 23 +++++++++++++---------- package.json | 6 +++--- 3 files changed, 36 insertions(+), 13 deletions(-) create mode 100644 .github/workflows/check-valid-tag.yml diff --git a/.github/workflows/check-valid-tag.yml b/.github/workflows/check-valid-tag.yml new file mode 100644 index 00000000..e72fdd25 --- /dev/null +++ b/.github/workflows/check-valid-tag.yml @@ -0,0 +1,20 @@ +name: Tagging +on: + push: + tags: + - '*' +jobs: + tag: + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Fail if tag is not prefixed by v + run: | + if [[ $GITHUB_REF_NAME =~ ^v[0-9]+\.[0-9]+\.[0-9].* ]]; then + echo "Valid version format" + else + echo "Invalid version format" + exit 1 + fi diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 11e3d6a2..d124bd3a 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -37,7 +37,9 @@ jobs: - name: Change the package.json version to match the tag run: | - sed -i.bak 's/"version": "[^"]*"/"version": "'"$GITHUB_REF_NAME"'"/' package.json && rm package.json.bak + VERSION=$(echo $GITHUB_REF_NAME | sed 's/^v//g') + echo "VERSION=${VERSION}" >> $GITHUB_ENV + sed -i.bak 's/"version": "[^"]*"/"version": "'"$VERSION"'"/' package.json && rm package.json.bak rm -f package.json.bak @@ -163,8 +165,8 @@ jobs: - name: Build signed installer if: runner.os == 'Windows' run: | - azuresigntool.exe sign --verbose -kvu ${{ secrets.AZURE_KEY_VAULT_URI }} -kvc ${{ secrets.AZURE_KEYVAULT_CERT_NAME }} -kva %AZ_TOKEN% -fd sha256 -tr http://timestamp.digicert.com -v "dist/AxonOps Workbench-%GITHUB_REF_NAME%-win-x64.exe" - azuresigntool.exe sign --verbose -kvu ${{ secrets.AZURE_KEY_VAULT_URI }} -kvc ${{ secrets.AZURE_KEYVAULT_CERT_NAME }} -kva %AZ_TOKEN% -fd sha256 -tr http://timestamp.digicert.com -v "dist/AxonOps Workbench-%GITHUB_REF_NAME%-win-x64.msi" + azuresigntool.exe sign --verbose -kvu ${{ secrets.AZURE_KEY_VAULT_URI }} -kvc ${{ secrets.AZURE_KEYVAULT_CERT_NAME }} -kva %AZ_TOKEN% -fd sha256 -tr http://timestamp.digicert.com -v "dist/AxonOps Workbench-%VERSION%-win-x64.exe" + azuresigntool.exe sign --verbose -kvu ${{ secrets.AZURE_KEY_VAULT_URI }} -kvc ${{ secrets.AZURE_KEYVAULT_CERT_NAME }} -kva %AZ_TOKEN% -fd sha256 -tr http://timestamp.digicert.com -v "dist/AxonOps Workbench-%VERSION%-win-x64.msi" shell: cmd # Ensure this task is right before the Upload @@ -236,7 +238,8 @@ jobs: - name: Make changes to Homebrew run: | - VERSION=$GITHUB_REF_NAME + VERSION=$(echo $GITHUB_REF_NAME | sed 's/^v//g') + echo "VERSION=$VERSION" >> $GITHUB_ENV case $VERSION in *internal*) NAME=axonopsworkbench-internal @@ -301,8 +304,8 @@ jobs: - name: Make changes to chocolatey run: | - set -x - VERSION=$GITHUB_REF_NAME + VERSION=$(echo $GITHUB_REF_NAME | sed 's/^v//g') + echo "VERSION=$VERSION" >> $GITHUB_ENV cd chocolatey git config user.name "GitHub Actions" git config user.email "actions@github.com" @@ -374,16 +377,16 @@ jobs: if: env.PUBLISH == 'yes' run: | for arch in ${{ env.DEBIAN_ARCHS }}; do - curl -sLO "https://github.com/axonops/axonops-workbench-cassandra/releases/download/$GITHUB_REF_NAME/AxonOps.Workbench-$GITHUB_REF_NAME-linux-${arch}.deb" + curl -sLO "https://github.com/axonops/axonops-workbench-cassandra/releases/download/$VERSION/AxonOps.Workbench-$VERSION-linux-${arch}.deb" gcloud config set project axonops-public - gcloud artifacts apt upload axonops-apt-${env.REPO_SUFFIX} --location=europe --source=AxonOps.Workbench-$GITHUB_REF_NAME-linux-${arch}.deb + gcloud artifacts apt upload axonops-apt-${env.REPO_SUFFIX} --location=europe --source=AxonOps.Workbench-$VERSION-linux-${arch}.deb done - name: Push RedHat package if: env.PUBLISH == 'yes' run: | for arch in ${{ env.REDHAT_ARCHS }}; do - curl -sLO "https://github.com/axonops/axonops-workbench-cassandra/releases/download/$GITHUB_REF_NAME/AxonOps.Workbench-$GITHUB_REF_NAME-linux-${arch}.rpm" + curl -sLO "https://github.com/axonops/axonops-workbench-cassandra/releases/download/$VERSION/AxonOps.Workbench-$VERSION-linux-${arch}.rpm" gcloud config set project axonops-public - gcloud artifacts yum upload axonops-yum-${env.REPO_SUFFIX} --location=europe --source=AxonOps.Workbench-$GITHUB_REF_NAME-linux-${arch}.rpm + gcloud artifacts yum upload axonops-yum-${env.REPO_SUFFIX} --location=europe --source=AxonOps.Workbench-$VERSION-linux-${arch}.rpm done \ No newline at end of file diff --git a/package.json b/package.json index ac35373c..12d9e823 100755 --- a/package.json +++ b/package.json @@ -30,14 +30,14 @@ "provider": "github" } ], - "artifactName": "${productName}-${version}-${os}-${arch}.${ext}", + "artifactName": "AxonOps.Workbench-${version}-${os}-${arch}.${ext}", "win": { "icon": "./renderer/assets/images/axonops-icon-256x256.ico", "target": [ "nsis", "msi" ], - "artifactName": "${productName}-${version}-${os}-${arch}.${ext}" + "artifactName": "AxonOps.Workbench-${version}-${os}-${arch}.${ext}" }, "linux": { "icon": "./renderer/assets/images/", @@ -49,7 +49,7 @@ "Keywords": "cassandra;axonops;development;workbench", "Icon": "/usr/share/icons/hicolor/256x256/apps/axonops-workbench.png" }, - "artifactName": "${productName}-${version}-${os}-${arch}.${ext}" + "artifactName": "AxonOps.Workbench-${version}-${os}-${arch}.${ext}" }, "mac": { "icon": "./renderer/assets/images/axonops-icon-512x512.icns",