Skip to content

Commit

Permalink
Implement Build Number (#149)
Browse files Browse the repository at this point in the history
  • Loading branch information
jkroepke authored May 30, 2023
1 parent eeecbfe commit d66845b
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 53 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
runs-on: ubuntu-20.04
steps:
- name: Checkout
uses: actions/checkout@v3.0.2
uses: actions/checkout@v3
with:
token: ${{ secrets.PAT }}
- name: Get the latest version of Lens
Expand Down
72 changes: 25 additions & 47 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ jobs:
run: |
export LENS_VERSION=$(cat version)
echo "LENS_VERSION=$LENS_VERSION" >> $GITHUB_ENV
echo "BUILD_NUMBER=${{ github.run_number }}" >> $GITHUB_ENV
shell: bash
- uses: actions/setup-node@v3
with:
Expand All @@ -38,7 +39,6 @@ jobs:
node update.js
- name: Build Lens
run: |
mkdir releasefiles
if [ "$RUNNER_OS" == "Windows" ]; then
choco install visualstudio2019buildtools visualstudio2019-workload-vctools
fi
Expand All @@ -58,34 +58,12 @@ jobs:
fi
npx nx run open-lens:build:app --x64 --arm64
for file in open-lens/dist/OpenLens-${{ env.LENS_VERSION }}.dmg; do
if [[ "$file" == *"arm64"* ]]; then
cp "$file" releasefiles/OpenLens-${{ env.LENS_VERSION }}-arm64.dmg
else
cp "$file" releasefiles/OpenLens-${{ env.LENS_VERSION }}.dmg
fi
done
for file in open-lens/dist/OpenLens-${{ env.LENS_VERSION }}-mac.zip; do
if [[ "$file" == *"arm64"* ]]; then
cp "$file" releasefiles/OpenLens-${{ env.LENS_VERSION }}-arm64.zip
else
cp "$file" releasefiles/OpenLens-${{ env.LENS_VERSION }}.zip
fi
done
elif [ "$RUNNER_OS" == "Linux" ]; then
npx nx run open-lens:build:app --x64 --arm64
cp open-lens/dist/OpenLens-${{ env.LENS_VERSION }}.x86_64.AppImage releasefiles/OpenLens-${{ env.LENS_VERSION }}.AppImage
cp open-lens/dist/OpenLens-${{ env.LENS_VERSION }}.amd64.deb releasefiles/OpenLens-${{ env.LENS_VERSION }}.deb
cp open-lens/dist/OpenLens-${{ env.LENS_VERSION }}.x86_64.rpm releasefiles/OpenLens-${{ env.LENS_VERSION }}.rpm
cp open-lens/dist/OpenLens-${{ env.LENS_VERSION }}.arm64.AppImage releasefiles/OpenLens-${{ env.LENS_VERSION }}.arm64.AppImage
cp open-lens/dist/OpenLens-${{ env.LENS_VERSION }}.arm64.deb releasefiles/OpenLens-${{ env.LENS_VERSION }}.arm64.deb
cp open-lens/dist/OpenLens-${{ env.LENS_VERSION }}.aarch64.rpm releasefiles/OpenLens-${{ env.LENS_VERSION }}.arm64.rpm
else
unset DOWNLOAD_ALL_ARCHITECTURES
npx nx run open-lens:build:app
cp open-lens/dist/OpenLens*.exe releasefiles/OpenLens-${{ env.LENS_VERSION }}.exe
cp open-lens/dist/OpenLens*.exe open-lens/dist/OpenLens-${{ env.LENS_VERSION }}.exe
cp open-lens/dist/OpenLens*.exe open-lens/dist/OpenLens-${{ env.LENS_VERSION }}.${{ env.BUILD_NUMBER }}.exe
fi
shell: bash
working-directory: lens
Expand All @@ -105,9 +83,9 @@ jobs:
- name: Calculate SHA256 checksum
run: |
if [ "$RUNNER_OS" == "Windows" ]; then
certutil -hashfile OpenLens-${{ env.LENS_VERSION }}.exe SHA256 | tee OpenLens-${{ env.LENS_VERSION }}.exe.sha256
certutil -hashfile OpenLens-${{ env.LENS_VERSION }}.${{ env.BUILD_NUMBER }}.exe SHA256 | tee OpenLens-${{ env.LENS_VERSION }}.${{ env.BUILD_NUMBER }}.exe.sha256
else
for filename in OpenLens-${{ env.LENS_VERSION }}*; do shasum -a 256 ${filename} | tee ${filename}.sha256 ; done
for filename in OpenLens-${{ env.LENS_VERSION }}.${{ env.BUILD_NUMBER }}*; do shasum -a 256 ${filename} | tee ${filename}.sha256 ; done
fi
shell: bash
working-directory: lens/open-lens/dist
Expand All @@ -118,40 +96,40 @@ jobs:
name: OpenLens-${{ matrix.os }}
retention-days: 5
path: |
lens/open-lens/dist/OpenLens-${{ env.LENS_VERSION }}*.dmg
lens/open-lens/dist/OpenLens-${{ env.LENS_VERSION }}*.AppImage
lens/open-lens/dist/OpenLens-${{ env.LENS_VERSION }}*.deb
lens/open-lens/dist/OpenLens-${{ env.LENS_VERSION }}*.rpm
lens/open-lens/dist/OpenLens-${{ env.LENS_VERSION }}*.zip
lens/open-lens/dist/OpenLens-${{ env.LENS_VERSION }}.exe
lens/open-lens/dist/OpenLens-${{ env.LENS_VERSION }}*.sha256
lens/open-lens/dist/OpenLens-${{ env.LENS_VERSION }}.${{ env.BUILD_NUMBER }}*.dmg
lens/open-lens/dist/OpenLens-${{ env.LENS_VERSION }}.${{ env.BUILD_NUMBER }}*.AppImage
lens/open-lens/dist/OpenLens-${{ env.LENS_VERSION }}.${{ env.BUILD_NUMBER }}*.deb
lens/open-lens/dist/OpenLens-${{ env.LENS_VERSION }}.${{ env.BUILD_NUMBER }}*.rpm
lens/open-lens/dist/OpenLens-${{ env.LENS_VERSION }}.${{ env.BUILD_NUMBER }}*.zip
lens/open-lens/dist/OpenLens-${{ env.LENS_VERSION }}.${{ env.BUILD_NUMBER }}.exe
lens/open-lens/dist/OpenLens-${{ env.LENS_VERSION }}.${{ env.BUILD_NUMBER }}*.sha256
- name: Generate Changelog
run: curl -s https://api.github.com/repos/lensapp/lens/releases/latest | jq -r 'select(.prerelease == false) | .body[0:]' > ${{ github.workspace }}-CHANGELOG.txt
- name: Release
uses: softprops/[email protected]
if: github.ref == 'refs/heads/main'
with:
tag_name: v${{ env.LENS_VERSION }}
tag_name: v${{ env.LENS_VERSION }}.${{ env.BUILD_NUMBER }}
body_path: ${{ github.workspace }}-CHANGELOG.txt
files: |
lens/open-lens/dist/OpenLens-${{ env.LENS_VERSION }}*.dmg
lens/open-lens/dist/OpenLens-${{ env.LENS_VERSION }}*.AppImage
lens/open-lens/dist/OpenLens-${{ env.LENS_VERSION }}*.deb
lens/open-lens/dist/OpenLens-${{ env.LENS_VERSION }}*.rpm
lens/open-lens/dist/OpenLens-${{ env.LENS_VERSION }}*.zip
lens/open-lens/dist/OpenLens-${{ env.LENS_VERSION }}.exe
lens/open-lens/dist/OpenLens-${{ env.LENS_VERSION }}*.sha256
lens/open-lens/dist/OpenLens-${{ env.LENS_VERSION }}.${{ env.BUILD_NUMBER }}*.dmg
lens/open-lens/dist/OpenLens-${{ env.LENS_VERSION }}.${{ env.BUILD_NUMBER }}*.AppImage
lens/open-lens/dist/OpenLens-${{ env.LENS_VERSION }}.${{ env.BUILD_NUMBER }}*.deb
lens/open-lens/dist/OpenLens-${{ env.LENS_VERSION }}.${{ env.BUILD_NUMBER }}*.rpm
lens/open-lens/dist/OpenLens-${{ env.LENS_VERSION }}.${{ env.BUILD_NUMBER }}*.zip
lens/open-lens/dist/OpenLens-${{ env.LENS_VERSION }}.${{ env.BUILD_NUMBER }}.exe
lens/open-lens/dist/OpenLens-${{ env.LENS_VERSION }}.${{ env.BUILD_NUMBER }}*.sha256
- name: Latest
uses: softprops/[email protected]
if: github.ref == 'refs/heads/main'
with:
tag_name: Latest
files: |
lens/open-lens/dist/OpenLens-${{ env.LENS_VERSION }}*.dmg
lens/open-lens/dist/OpenLens-${{ env.LENS_VERSION }}*.AppImage
lens/open-lens/dist/OpenLens-${{ env.LENS_VERSION }}*.deb
lens/open-lens/dist/OpenLens-${{ env.LENS_VERSION }}*.rpm
lens/open-lens/dist/OpenLens-${{ env.LENS_VERSION }}*.zip
lens/open-lens/dist/OpenLens.Setup.${{ env.LENS_VERSION }}.exe
lens/open-lens/dist/OpenLens-${{ env.LENS_VERSION }}.${{ env.BUILD_NUMBER }}*.dmg
lens/open-lens/dist/OpenLens-${{ env.LENS_VERSION }}.${{ env.BUILD_NUMBER }}*.AppImage
lens/open-lens/dist/OpenLens-${{ env.LENS_VERSION }}.${{ env.BUILD_NUMBER }}*.deb
lens/open-lens/dist/OpenLens-${{ env.LENS_VERSION }}.${{ env.BUILD_NUMBER }}*.rpm
lens/open-lens/dist/OpenLens-${{ env.LENS_VERSION }}.${{ env.BUILD_NUMBER }}*.zip
lens/open-lens/dist/OpenLens.Setup.${{ env.LENS_VERSION }}.${{ env.BUILD_NUMBER }}.exe
lens/open-lens/dist/lates*.yml
15 changes: 10 additions & 5 deletions update.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,18 @@
const fs = require('fs');

var packagejson = require('./lens/open-lens/package.json');
const packageJsonOpenLens = require('./lens/open-lens/package.json');

packagejson.build.publish = [{
packageJsonOpenLens.build.publish = [{
url: "https://github.com/MuhammedKalkan/OpenLens/releases/download/Latest",
provider: "generic"
}];

packagejson.build.win.artifactName = "OpenLens.Setup.${version}.${ext}";
packagejson.build.npmRebuild = true;
packageJsonOpenLens.version = `${packageJsonOpenLens.version}+${process.env.BUILD_NUMBER}`;
packageJsonOpenLens.build.artifactName = "${productName}-${buildVersion}-${arch}-${os}.${ext}";
packageJsonOpenLens.build.linux.artifactName = packageJsonOpenLens.build.linux.artifactName.replace("${version}", "${buildVersion}");
packageJsonOpenLens.build.win.artifactName = "OpenLens.Setup.${buildVersion}.${ext}";
packageJsonOpenLens.build.npmRebuild = true;

fs.writeFileSync('./lens/open-lens/package.json', JSON.stringify(packagejson));
console.log(`Set build version: ${packageJsonOpenLens.version}`)

fs.writeFileSync('./lens/open-lens/package.json', JSON.stringify(packageJsonOpenLens, null, 2));

0 comments on commit d66845b

Please sign in to comment.