Skip to content

release-app-advance

release-app-advance #2

name: "release-app-advance"
on:
workflow_run:
workflows: [Build-And-Test-App]
types:
- completed
branches:
- main
jobs:
release-app:
runs-on: windows-latest
permissions:
actions: write
if: ${{ github.event.workflow_run.conclusion == 'success' }}
steps:
- name: 'Download artifact'
uses: actions/github-script@v6
with:
script: |
let packs = ["app-advance-windows"];
let artifactsObj = await github.rest.actions.listWorkflowRunArtifacts({
owner: context.repo.owner,
repo: context.repo.repo,
run_id: context.payload.workflow_run.id,
});
for (var item of packs) {
console.log(item);
let requiredArtifact = artifactsObj.data.artifacts.filter((artifact) => {
return artifact.name == item
})[0];
let download = await github.rest.actions.downloadArtifact({
owner: context.repo.owner,
repo: context.repo.repo,
artifact_id: requiredArtifact.id,
archive_format: 'zip',
});
let fs = require('fs');
let workspace = `${process.env.GITHUB_WORKSPACE}/`;
fs.writeFileSync(workspace+item+'.zip', Buffer.from(download.data));
};
- name: 'Unzip Artifacts'
run: |
unzip app-advance-windows.zip
- name: 🟢 Node
uses: actions/setup-node@v4
with:
always-auth: true
node-version: 18
scope: '@naveed235812'
registry-url: https://registry.npmjs.org
- name: Publish Artifacts
run: |
import os
from glob import glob
artifacts = glob('naveed235812-app-advance-windows*.tgz')
for artifact in artifacts:
os.system("npm publish --access public " + artifact)
shell: python
env:
NODE_AUTH_TOKEN: ${{secrets.NPM_AUTH_TOKEN_APP}}