Skip to content

Commit

Permalink
ci: add release workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
piavgh committed Mar 29, 2024
1 parent 207d772 commit b5371f1
Showing 1 changed file with 72 additions and 0 deletions.
72 changes: 72 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
name: 'Release'

permissions: write-all

on:
workflow_dispatch:
inputs:
version:
description: 'Release version'
type: string
required: true

jobs:
prepare:
runs-on: [ubuntu-22.04]
outputs:
version_tag: ${{ steps.version_tag.outputs.value }}
build_date: ${{ steps.build_date.outputs.value }}
steps:
- name: Check branch
if: ${{ !startsWith(github.ref, 'refs/heads/release') }}
run: |
echo "This workflow should be triggered with workflow_dispatch on release branch"
exit 1
- name: Format version tag
shell: bash
id: version_tag
env:
INPUT_TAG: ${{ github.event.inputs.version }}
run: |
TAG=${INPUT_TAG#v}
echo "::set-output name=value::v$TAG"
- name: Build date
shell: bash
id: build_date
run: echo "::set-output name=value::$(date +%FT%T%z)"

release:
needs:
- prepare
runs-on: [ ubuntu-22.04 ]
env:
VERSION_TAG: ${{ needs.prepare.outputs.version_tag }}
steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0

- name: Setup Go
uses: actions/setup-go@v2
with:
go-version: "1.21.x"

- name: Setup Git
run: |
git config user.name "$GITHUB_ACTOR"
git config user.email "[email protected]"
- name: Create tag
run: |
git tag -d "$VERSION_TAG" 2> /dev/null || echo "Release tag '$VERSION_TAG' does NOT exist"
git tag --annotate --message "uniswapv3-sdk $VERSION_TAG" "$VERSION_TAG"
git push origin "refs/tags/$VERSION_TAG"
- name: Create release
uses: softprops/action-gh-release@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
tag_name: ${{ env.VERSION_TAG }}
prerelease: false
name: "Uniswap V3 SDK ${{ env.VERSION_TAG }}"

0 comments on commit b5371f1

Please sign in to comment.