Skip to content

Commit

Permalink
Enhancement: Upload release assets
Browse files Browse the repository at this point in the history
  • Loading branch information
localheinz committed Mar 19, 2022
1 parent 262eb56 commit 3f586fc
Showing 1 changed file with 43 additions and 0 deletions.
43 changes: 43 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ jobs:

runs-on: "ubuntu-latest"

env:
COMPOSER_NORMALIZE_PHAR: ".build/phar/composer-normalize.phar"
COMPOSER_NORMALIZE_PHAR_SIGNATURE: ".build/phar/composer-normalize.phar.asc"

steps:
- name: "Determine tag"
run: "echo \"RELEASE_TAG=${GITHUB_REF#refs/tags/}\" >> $GITHUB_ENV"
Expand All @@ -35,3 +39,42 @@ jobs:
} catch (error) {
core.setFailed(error.message);
}
- name: "Create release asset directory"
run: "mkdir -p .build/phar/"

- name: "Create release assets"
run: "touch ${{ env.COMPOSER_NORMALIZE_PHAR }} ${{ env.COMPOSER_NORMALIZE_PHAR_ASC }}"

- name: "Upload release assets"
uses: "actions/github-script@v6"
with:
github-token: "${{ secrets.ERGEBNIS_BOT_TOKEN }}"
script: |
const fs = require("fs");
const files = [
{
name: "composer-normalize.phar",
path: process.env.COMPOSER_NORMALIZE_PHAR,
},
{
name: "composer-normalize.phar.asc",
path: process.env.COMPOSER_NORMALIZE_PHAR_SIGNATURE,
},
];
for (const file of files) {
try {
await github.rest.repos.uploadReleaseAsset({
data: fs.readFileSync(file.path),
name: file.name,
origin: process.env.RELEASE_UPLOAD_URL,
owner: context.repo.owner,
release_id: process.env.RELEASE_ID,
repo: context.repo.repo,
});
} catch (error) {
core.setFailed(error.message);
}
}

0 comments on commit 3f586fc

Please sign in to comment.