Skip to content

Publish

Publish #7

Workflow file for this run

name: Publish
on:
workflow_run:
workflows: [CI]
types: [completed]
branches: [master]
permissions:
contents: write
jobs:
publish:
runs-on: ubuntu-latest
if: ${{ github.event.workflow_run.conclusion == 'success' }}
steps:
- uses: actions/checkout@v4
with:
ref: releases
- name: Download artifact
uses: actions/github-script@v6
with:
script: |
let allArtifacts = await github.rest.actions.listWorkflowRunArtifacts({
owner: context.repo.owner,
repo: context.repo.repo,
run_id: context.payload.workflow_run.id,
});
let matchArtifact = allArtifacts.data.artifacts.filter((artifact) => {
return artifact.name == "moneymanager2"
})[0];
let download = await github.rest.actions.downloadArtifact({
owner: context.repo.owner,
repo: context.repo.repo,
artifact_id: matchArtifact.id,
archive_format: 'zip',
});
let fs = require('fs');
fs.writeFileSync(`${process.env.GITHUB_WORKSPACE}/moneymanager2.zip`, Buffer.from(download.data));
- run: |
rm main
rm -rf public
- run: unzip -f moneymanager2.zip
- name: Commit changes
run: |
git config --global user.name "GitHub Actions"
git config --global user.email "<>"
git add .
git commit -m "Automatic release"
git push origin releases --force