Skip to content

Packaging fixes

Packaging fixes #18

Workflow file for this run

name: Create Release on Tag
on:
push:
tags:
- 'v*.*.*'
- 'test-*.*.*'
permissions:
contents: write
jobs:
release:
runs-on: ubuntu-22.04
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
ref: ${{ github.ref }}
- name: Extract changelog for tag
id: changelog
run: |
TAG_NAME=$(echo ${{ github.ref_name }})
VERSION_NAME=$(echo $TAG_NAME | sed 's/^v//;s/^test-//')
echo "Extracting changelog for tag: $TAG_NAME"
# Find the changelog section for this tag
CHANGELOG=$(awk -v tag="## $TAG_NAME " '$0 ~ tag {flag=1; next} /^## / && flag {flag=0} flag && /^-/ {print}' CHANGELOG.md)
if [ -z "$CHANGELOG" ]; then
echo "No changelog entries found for $TAG_NAME"
exit 1
fi
# Format release notes
RELEASE_NOTES="$CHANGELOG"
echo "release_notes<<EOF" >> $GITHUB_ENV
echo "$RELEASE_NOTES" >> $GITHUB_ENV
echo "EOF" >> $GITHUB_ENV
echo "tag_name=$TAG_NAME" >> $GITHUB_ENV
echo "version_name=$VERSION_NAME" >> $GITHUB_ENV
- name: Install system dependencies
run: |
sudo apt-get update
sudo apt-get install -y pkg-config libssl-dev libgtk-4-dev makeself libwebkitgtk-6.0-dev rpm fakeroot
- name: Install Rust
run: |
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
source $HOME/.cargo/env
- name: Build project
run: |
chmod +x package/build-lto.sh
./package/build-lto.sh --features=vendored-openssl
- name: Package project
run: |
chmod +x package/package.sh
./package/package.sh
- name: Build project with mobile-access feature
run: ./package/build-lto.sh --features=vendored-openssl,mobile-access
- name: Package project with mobile-access feature
run: ./package/package.sh -webkit
- name: Create Release
if: ${{ !startsWith(github.ref_name, 'test-') }}
uses: actions/github-script@v7
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const fs = require('fs');
const tagName = process.env.tag_name;
const versionName = process.env.version_name;
const releaseNotes = process.env.release_notes;
const artifactPath = `target/snx-rs-${tagName}-linux-x86_64.tar.xz`;
const installerPath = `target/snx-rs-${tagName}-linux-x86_64.run`;
const artifactPathMA = `target/snx-rs-${tagName}-webkit-linux-x86_64.tar.xz`;
const installerPathMA = `target/snx-rs-${tagName}-webkit-linux-x86_64.run`;
const debPath = `target/snx-rs-${tagName}-linux-x86_64.deb`;
const rpmPath = `target/snx-rs-${tagName}-linux-x86_64.rpm`;
const release = await github.rest.repos.createRelease({
owner: context.repo.owner,
repo: context.repo.repo,
tag_name: tagName,
name: `Version ${versionName}`,
body: releaseNotes,
draft: false,
prerelease: false
});
const artifact = fs.readFileSync(artifactPath);
await github.rest.repos.uploadReleaseAsset({
owner: context.repo.owner,
repo: context.repo.repo,
release_id: release.data.id,
name: `snx-rs-${tagName}-linux-x86_64.tar.xz`,
data: artifact
});
const installer = fs.readFileSync(installerPath);
await github.rest.repos.uploadReleaseAsset({
owner: context.repo.owner,
repo: context.repo.repo,
release_id: release.data.id,
name: `snx-rs-${tagName}-linux-x86_64.run`,
data: installer
});
const artifactMA = fs.readFileSync(artifactPathMA);
await github.rest.repos.uploadReleaseAsset({
owner: context.repo.owner,
repo: context.repo.repo,
release_id: release.data.id,
name: `snx-rs-${tagName}-webkit-linux-x86_64.tar.xz`,
data: artifactMA
});
const installerMA = fs.readFileSync(installerPathMA);
await github.rest.repos.uploadReleaseAsset({
owner: context.repo.owner,
repo: context.repo.repo,
release_id: release.data.id,
name: `snx-rs-${tagName}-webkit-linux-x86_64.run`,
data: installerMA
});
const artifactDeb = fs.readFileSync(debPath);
await github.rest.repos.uploadReleaseAsset({
owner: context.repo.owner,
repo: context.repo.repo,
release_id: release.data.id,
name: `snx-rs-${tagName}-linux-x86_64.deb`,
data: artifactDeb
});
const artifactRpm = fs.readFileSync(rpmPath);
await github.rest.repos.uploadReleaseAsset({
owner: context.repo.owner,
repo: context.repo.repo,
release_id: release.data.id,
name: `snx-rs-${tagName}-linux-x86_64.rpm`,
data: artifactRpm
});