Skip to content

Update release.yml

Update release.yml #12

Workflow file for this run

# This workflow will build a golang project
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-go
name: release
on:
push:
branches: [ "main" ]
tags: ['**']
pull_request:
branches: [ "main" ]
jobs:
build:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: '1.21'
- name: vars
id: vars
run: |
export commit=$(git rev-parse HEAD)
export short=$(git rev-parse --short HEAD)
export github_tag=${{github.ref_name}}
export tag=$github_tag
echo "::set-output name=commit::$commit"
echo "::set-output name=short::$short"
echo "::set-output name=github_tag::$github_tag"
echo "::set-output name=tag::$tag"
- name: show environment
run: |
echo vars.commit = ${{steps.vars.outputs.commit}}
echo vars.short_commit = ${{steps.vars.outputs.short}}
echo vars.github_tag = ${{steps.vars.outputs.github_tag}}
echo vars.tag = ${{steps.vars.outputs.tag}}
- name: Build
run: make build
- name: Tar Release
if: startsWith(github.ref, 'refs/tags/')
run: |
tar -zcvf ./dingtalk_${{steps.vars.outputs.tag}}_ubuntu.tar.gz ./dingtalk
- name: shasum
if: startsWith(github.ref, 'refs/tags/')
run: shasum -a 256 ./dingtalk_${{steps.vars.outputs.tag}}_ubuntu.tar.gz > ./dingtalk_${{steps.vars.outputs.tag}}_ubuntu.sha256
shell: bash
- name: Release
id: release
uses: softprops/action-gh-release@v2
if: startsWith(github.ref, 'refs/tags/')
with:
files: |
./dingtalk_${{steps.vars.outputs.tag}}_ubuntu.tar.gz
./dingtalk_${{steps.vars.outputs.tag}}_ubuntu.sha256