mirror of
https://code.forgejo.org/actions/go-versions
synced 2025-06-13 22:04:12 +02:00
fixed upload
This commit is contained in:
parent
ef31b88f8b
commit
f7ebcc07a5
1 changed files with 20 additions and 27 deletions
47
.github/workflows/build-go-packages.yml
vendored
47
.github/workflows/build-go-packages.yml
vendored
|
@ -6,7 +6,7 @@ on:
|
||||||
VERSION:
|
VERSION:
|
||||||
description: 'Go version to build and upload'
|
description: 'Go version to build and upload'
|
||||||
required: true
|
required: true
|
||||||
default: '14.2.0'
|
default: '1.15.0'
|
||||||
PUBLISH_RELEASES:
|
PUBLISH_RELEASES:
|
||||||
description: 'Whether to publish releases'
|
description: 'Whether to publish releases'
|
||||||
required: true
|
required: true
|
||||||
|
@ -138,6 +138,8 @@ jobs:
|
||||||
outputs:
|
outputs:
|
||||||
upload_url: ${{ steps.create_release.outputs.upload_url }}
|
upload_url: ${{ steps.create_release.outputs.upload_url }}
|
||||||
steps:
|
steps:
|
||||||
|
- uses: actions/download-artifact@v2
|
||||||
|
|
||||||
- name: Publish Release ${{ env.VERSION }}
|
- name: Publish Release ${{ env.VERSION }}
|
||||||
id: create_release
|
id: create_release
|
||||||
uses: actions/create-release@v1
|
uses: actions/create-release@v1
|
||||||
|
@ -147,34 +149,25 @@ jobs:
|
||||||
tag_name: ${{ env.VERSION }}-${{ github.run_id }}
|
tag_name: ${{ env.VERSION }}-${{ github.run_id }}
|
||||||
release_name: ${{ env.VERSION }}
|
release_name: ${{ env.VERSION }}
|
||||||
body: |
|
body: |
|
||||||
Upload Go.js ${{ env.VERSION }}
|
Upload Go ${{ env.VERSION }}
|
||||||
upload_assets:
|
|
||||||
name: Upload assets for ${{ matrix.platform }}
|
|
||||||
needs: publish_release
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
env:
|
|
||||||
UPLOAD_URL: ${{ needs.publish_release.outputs.upload_url }}
|
|
||||||
strategy:
|
|
||||||
matrix:
|
|
||||||
extension: ['tar.gz']
|
|
||||||
platform: [linux, darwin]
|
|
||||||
include:
|
|
||||||
- platform: win32
|
|
||||||
extension: 7z
|
|
||||||
steps:
|
|
||||||
- uses: actions/download-artifact@v2
|
|
||||||
with:
|
|
||||||
name: go-${{ env.VERSION }}-${{ matrix.platform }}
|
|
||||||
|
|
||||||
- name: Upload Release Asset
|
- name: Upload release assets
|
||||||
uses: actions/upload-release-asset@v1
|
uses: actions/github-script@v2
|
||||||
env:
|
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
with:
|
with:
|
||||||
upload_url: ${{ env.UPLOAD_URL }}
|
github-token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
asset_path: ./go-${{ env.VERSION }}-${{ matrix.platform }}-${{ env.ARCHITECTURE }}.${{ matrix.extension }}
|
script: |
|
||||||
asset_name: go-${{ env.VERSION }}-${{ matrix.platform }}-${{ env.ARCHITECTURE }}.${{ matrix.extension }}
|
const fs = require('fs');
|
||||||
asset_content_type: application/zip
|
for (let artifactDir of fs.readdirSync('.')) {
|
||||||
|
let artifactName = fs.readdirSync(`${artifactDir}`)[0];
|
||||||
|
console.log(`Upload ${artifactName} asset`);
|
||||||
|
github.repos.uploadReleaseAsset({
|
||||||
|
owner: context.repo.owner,
|
||||||
|
repo: context.repo.repo,
|
||||||
|
release_id: ${{ steps.create_release.outputs.id }},
|
||||||
|
name: artifactName,
|
||||||
|
data: fs.readFileSync(`./${artifactDir}/${artifactName}`)
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
trigger_pr:
|
trigger_pr:
|
||||||
name: Trigger Pull Request
|
name: Trigger Pull Request
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue