Skip to content

Create Release

Create Release #11

Workflow file for this run

name: Create Release
on:
push:
tags:
- 'v*'
workflow_dispatch:
jobs:
build:
name: Create Release
runs-on: ocean
steps:
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: '1.23.x'
cache: false
- name: Checkout code
uses: actions/checkout@v2
- name: Build Artifacts
run: go run build_release.go
- name: Create Release
uses: actions/github-script@v2
with:
github-token: ${{secrets.MY_PAT_TOKEN}}
script: |
const fs = require('fs').promises;
console.log('environment', process.versions);
const { repo: { owner, repo }, sha } = context;
const release = await github.repos.createRelease({
owner, repo,
tag_name: process.env.GITHUB_REF,
name: process.env.GITHUB_REF.split('/')[2],
draft: true,
target_commitish: sha
});
console.log('created release', { release });
for (let file of await fs.readdir('./release')) {
console.log('uploading', file);
await github.repos.uploadReleaseAsset({
owner, repo,
release_id: release.data.id,
name: file,
data: await fs.readFile(`./release/${file}`)
});
}