Skip to content

Version 0.9.8

Version 0.9.8 #88

Workflow file for this run

name: On release
on:
release:
types: [created]
permissions:
contents: write
pull-requests: read
jobs:
upload-macos-arm64-release-asset:
runs-on: macos-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 18.x
- run: npm ci
- name: Build standalone apps
run: |
npx pkg . -t macos-arm64 --compress GZip
cd ./dist
chmod 775 heta-compiler
tar -czvf ./heta-compiler-macos-arm64.tar.gz ./heta-compiler
cd ..
- name: Upload Release Asset Macos
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ github.event.release.upload_url }}
asset_path: dist/heta-compiler
asset_name: heta-compiler-macos-arm64
asset_content_type: application/octet-stream
- name: Upload Release TAR.GZ Macos
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ github.event.release.upload_url }}
asset_path: dist/heta-compiler-macos-arm64.tar.gz
asset_name: heta-compiler-macos-arm64.tar.gz
asset_content_type: application/octet-stream
- name: Configure SSH
run: |
mkdir -p ~/.ssh
echo "$DEPLOY_KEY" > ~/.ssh/id_rsa
chmod 600 ~/.ssh/id_rsa
ssh-keyscan github.com >> ~/.ssh/known_hosts
env:
DEPLOY_KEY: ${{ secrets.DEPLOY_HOMEBREW_HETA_COMPILER }}
- name: Commit to homebrew-heta-compiler repos
if: ${{ github.event.release.prerelease == false }}
run: |
git clone git@github.com:hetalang/homebrew-heta-compiler.git
cd homebrew-heta-compiler
git config user.name "GitHub Actions"
git config user.email "actions@github.com"
mkdir -p Formula
cp -f ../build-homebrew/heta-compiler.template.rb Formula/heta-compiler.rb # copy the new formula and replace the old one
sed -i '' "s|\$VERSION|${{ github.event.release.tag_name }}|" Formula/heta-compiler.rb
SHA=$(shasum -a 256 ../dist/heta-compiler-macos-arm64.tar.gz | awk '{print $1}')
sed -i '' "s|\$SHA256|$SHA|" Formula/heta-compiler.rb
git add .
git commit -m "Automated update from source repository based on release ${{ github.event.release.tag_name }}"
git push origin master
upload-macos-x64-release-asset:
runs-on: macos-13
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 18.x
- run: npm ci
- name: Build standalone apps
run: |
npx pkg . -t macos-x64 --compress GZip
cd ./dist
chmod 775 heta-compiler
tar -czvf ./heta-compiler-macos-x64.tar.gz ./heta-compiler
cd ..
- name: Upload Release Asset Macos
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ github.event.release.upload_url }}
asset_path: dist/heta-compiler
asset_name: heta-compiler-macos-x64
asset_content_type: application/octet-stream
- name: Upload Release TAR.GZ Macos
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ github.event.release.upload_url }}
asset_path: dist/heta-compiler-macos-x64.tar.gz
asset_name: heta-compiler-macos-x64.tar.gz
asset_content_type: application/octet-stream
upload-linux-x64-release-asset:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 18.x
- run: npm ci
- name: Build standalone apps
run: |
npx pkg . -t linux --compress GZip
cd ./dist
chmod 775 heta-compiler
tar -czvf ./heta-compiler-linux-x64.tar.gz ./heta-compiler
cd ..
- name: Create .deb package
run: |
VERSION=$(node -p "require('./package.json').version")
mkdir -p dist/heta-compiler-deb/DEBIAN
cp build-deb/control.template dist/heta-compiler-deb/DEBIAN/control
sed -i "s|\$VERSION|$VERSION|" dist/heta-compiler-deb/DEBIAN/control
mkdir -p dist/heta-compiler-deb/usr/local/bin
cp dist/heta-compiler dist/heta-compiler-deb/usr/local/bin/heta
dpkg-deb --build dist/heta-compiler-deb
- name: Upload Release Asset Linux
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ github.event.release.upload_url }}
asset_path: dist/heta-compiler
asset_name: heta-compiler-linux-x64
asset_content_type: application/octet-stream
- name: Upload Release TAR.GZ Linux
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ github.event.release.upload_url }}
asset_path: dist/heta-compiler-linux-x64.tar.gz
asset_name: heta-compiler-linux-x64.tar.gz
asset_content_type: application/octet-stream
- name: Upload Release DEB Linux
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ github.event.release.upload_url }}
asset_path: dist/heta-compiler-deb.deb
asset_name: heta-compiler-x64.deb
asset_content_type: application/octet-stream
upload-linux-arm64-release-asset:
runs-on: ubuntu-22.04-arm
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 18.x
- run: npm ci
- name: Build standalone apps
run: |
npx pkg . -t linux-arm64 --compress GZip
cd ./dist
chmod 775 heta-compiler
tar -czvf ./heta-compiler-linux-arm64.tar.gz ./heta-compiler
cd ..
- name: Upload Release Asset Linux
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ github.event.release.upload_url }}
asset_path: dist/heta-compiler
asset_name: heta-compiler-linux-arm64
asset_content_type: application/octet-stream
- name: Upload Release TAR.GZ Linux
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ github.event.release.upload_url }}
asset_path: dist/heta-compiler-linux-arm64.tar.gz
asset_name: heta-compiler-linux-arm64.tar.gz
asset_content_type: application/octet-stream
upload-windows-x64-release-asset:
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 18.x
- run: npm ci
- name: Build standalone apps
run: |
npx pkg . -t win --compress GZip
cd ./dist
cp -Force heta-compiler.exe heta-compiler-win-x64.exe
tar -czvf ./heta-compiler-windows-x64.tar.gz ./heta-compiler.exe
cd ..
- name: Get package version
id: package_version
run: | # deprecated
$version = node -p "require('./package.json').version"
echo "VERSION=$version" >> $env:GITHUB_OUTPUT
- name: Install WiX Toolset
run: |
choco install wixtoolset
- name: Generate new GUID
id: new_guid
run: | # deprecated
$guid = [guid]::NewGuid().ToString().ToUpper()
echo "NewGUID=$guid" >> $env:GITHUB_OUTPUT
- name: Update .wxs file with new Product Id
run: |
echo "GUID: ${{ steps.new_guid.outputs.NewGUID }}"
$pathToWxs = "build-win-installer/perUser.wxs"
$content = Get-Content $pathToWxs -Raw
$newContent1 = $content -replace '(?<=Product\s+Id=")[^"]*', "${{ steps.new_guid.outputs.NewGUID }}"
$newContent2 = $newContent1 -replace '(?<=Version\s*=\s*")0\.0\.0', "${{ steps.package_version.outputs.VERSION }}"
$newContent2 | Set-Content $pathToWxs
- name: Build windows installer
run: |
& ${env:WIX}bin\candle.exe -o dist/ build-win-installer/perUser.wxs
& ${env:WIX}bin\light.exe -o dist/heta-compiler-win-x64-installer.msi dist/perUser.wixobj -ext WixUIExtension
- name: Upload Release Asset Win MSI
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ github.event.release.upload_url }} # part of the GitHub Actions context
asset_path: dist/heta-compiler-win-x64-installer.msi
asset_name: heta-compiler-${{ steps.package_version.outputs.VERSION }}-win-x64-installer.msi
asset_content_type: application/octet-stream
- name: Upload Release TAR.GZ Windows
uses: softprops/action-gh-release@v2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
files: |
dist/heta-compiler-windows-x64.tar.gz
dist/heta-compiler-win-x64.exe
- name: Prepare files to publish in choco
run: |
mkdir -p dist/build-choco/tools
cp -Force dist/heta-compiler.exe dist/build-choco/tools/heta.exe
cp -Force LICENSE dist/build-choco/tools/LICENSE.txt
$VERSION = node -p "require('./package.json').version"
$SHA256 = (Get-FileHash -Path .\dist\build-choco\tools\heta.exe -Algorithm SHA256).Hash
$RELEASE_NOTES = "See https://raw.githubusercontent.com/hetalang/heta-compiler/refs/heads/master/CHANGELOG.md"
$BUILD_TIMESTAMP = (Get-Date).ToString("yyyy-MM-dd")
(Get-Content build-choco/tools/VERIFICATION.tempate.txt) `
-replace '\$SHA256', $SHA256 `
-replace '\$VERSION', $VERSION `
-replace '\$BUILD_TIMESTAMP', $BUILD_TIMESTAMP |
Set-Content dist/build-choco/tools/VERIFICATION.txt
(Get-Content build-choco/heta-compiler.template.nuspec) `
-replace '\$VERSION', $VERSION `
-replace '\$RELEASE_NOTES', $RELEASE_NOTES |
Set-Content dist/build-choco/heta-compiler.nuspec
- name: Build for choco and publish
if: ${{ github.event.release.prerelease == false }}
env:
CHOCO_API_KEY: ${{ secrets.DEPLOY_CHOCO_HETA_COMPILER }}
run: |
$VERSION = node -p "require('./package.json').version"
choco pack dist/build-choco/heta-compiler.nuspec --output-directory dist --version $VERSION
choco push dist/heta-compiler.$VERSION.nupkg --source https://push.chocolatey.org/ --api-key $env:CHOCO_API_KEY