Skip to content

Merge pull request #316 from michimani/release/0.15.0 #48

Merge pull request #316 from michimani/release/0.15.0

Merge pull request #316 from michimani/release/0.15.0 #48

Workflow file for this run

name: release
on:
push:
tags:
- "v[0-9]+.[0-9]+.[0-9]+"
jobs:
test:
name: Test
runs-on: ubuntu-latest
steps:
- name: Set up Go 1.22
uses: actions/setup-go@v5
with:
go-version: "1.22"
- name: Check out code into the Go module directory
uses: actions/checkout@v4
- name: Get dependencies
run: go install
- name: Test code
run: go test github.com/michimani/gotwi/... -shuffle=on
setup-release:
name: Setup release
needs: test
runs-on: ubuntu-latest
steps:
- name: Create release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ github.ref }}
draft: false
prerelease: false
- name: Get url to upload to release from output
env:
url: ${{ steps.create_release.outputs.upload_url }}
run: |
mkdir artifact
echo $url > artifact/url.txt
- name: Upload artifact to share url with other jobs
uses: actions/upload-artifact@v1
with:
name: artifact
path: artifact/url.txt
release-code:
name: Release Source Code
needs: setup-release
runs-on: ubuntu-latest
steps:
- name: Download artifact to get url to upload to release
uses: actions/download-artifact@v4
with:
name: artifact
- name: Get url to upload to release from artifact
id: get_url
run: |
pwd
ls -al
url=$(cat url.txt)
echo "##[set-output name=upload_url;]$url"
- name: Check out code into the Go module directory
uses: actions/checkout@v4
- name: Pack source code in zip file
run: |
mkdir dist
ls -la
cp *.go dist/
zip -j -r release dist
- name: Upload release asset
uses: actions/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.get_url.outputs.upload_url }}
asset_path: release.zip
asset_name: source.zip
asset_content_type: application/zip