Upload AppImage

This commit is contained in:
lights0123 2020-09-27 17:12:08 -04:00
parent a1149a8afb
commit ddbd69f85d
No known key found for this signature in database
GPG key ID: 28F315322E37972F
2 changed files with 68 additions and 7 deletions

View file

@ -5,11 +5,37 @@ on:
- release
jobs:
create-release:
runs-on: ubuntu-latest
outputs:
RELEASE_UPLOAD_ID: ${{ steps.create_release.outputs.id }}
RELEASE_UPLOAD_URL: ${{ steps.create_release.outputs.upload_url }}
steps:
- uses: actions/checkout@v2
- name: setup node
uses: actions/setup-node@v1
with:
node-version: 12
- name: get version
run: echo ::set-env name=PACKAGE_VERSION::$(node -p "require('./package.json').version")
- name: create release
id: create_release
uses: actions/create-release@v1.1.0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: v${{ env.PACKAGE_VERSION }}
release_name: "N-Link v${{ env.PACKAGE_VERSION }}"
body: "See the assets to download this version and install."
draft: true
prerelease: false
publish-tauri:
needs: create-release
strategy:
fail-fast: false
matrix:
platform: [macos-latest, ubuntu-18.04, windows-latest]
platform: [ macos-latest, ubuntu-18.04, windows-latest ]
runs-on: ${{ matrix.platform }}
steps:
@ -58,12 +84,47 @@ jobs:
- name: install app dependencies
run: yarn
- uses: tauri-apps/tauri-action@v0
if: runner.os == 'Linux'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
npmScript: "tauri:build"
tagName: v__VERSION__ # the action automatically replaces \_\_VERSION\_\_ with the app version
releaseName: "N-Link v__VERSION__"
body: "See the assets to download this version and install."
draft: true
prerelease: false
- uses: tauri-apps/tauri-action@v0
if: runner.os != 'Linux'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
npmScript: "tauri:build"
releaseId: ${{ needs.create-release.outputs.RELEASE_UPLOAD_ID }}
- name: Upload Release
if: runner.os == 'Linux'
uses: actions/github-script@v2
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
console.log('environment', process.versions);
const fs = require('fs').promises;
const {repo: {owner, repo}, sha} = context;
console.log({owner, repo, sha});
const {name, version} = require('./package.json');
const arch = process.arch === 'x64' ? 'amd64' : process.arch;
for (let file of (await fs.readdir('src-tauri/target/release/bundle/deb', {withFileTypes: true})).filter(dir => dir.isFile()).map(({name}) => name)) {
console.log('uploading', file);
await github.repos.uploadReleaseAsset({
owner, repo,
release_id: "${{ needs.create-release.outputs.RELEASE_UPLOAD_ID }}",
name: file,
data: await fs.readFile(`./${file}`)
});
}
await github.repos.uploadReleaseAsset({
owner, repo,
release_id: "${{ needs.create-release.outputs.RELEASE_UPLOAD_ID }}",
name: `${name}_${version}_${arch}.AppImage`,
data: await fs.readFile(`src-tauri/target/release/bundle/appimage/n-link.AppImage`)
});

View file

@ -6,7 +6,7 @@
},
"bundle": {
"active": true,
"targets": "all",
"targets": ["deb", "msi", "appimage", "dmg"],
"identifier": "com.lights0123.n-link",
"icon": [
"icons/32x32.png",