Skip to content

Commit

Permalink
apply version via github action
Browse files Browse the repository at this point in the history
  • Loading branch information
ZibanPirate committed Nov 17, 2024
1 parent 0c211d3 commit dfec1a1
Showing 1 changed file with 49 additions and 0 deletions.
49 changes: 49 additions & 0 deletions .github/workflows/draft-new-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: "Draft New Release"

on:
workflow_dispatch:
inputs:
version:
description: "eg. 0.1.0"
required: true

jobs:
apply-version:
name: cargo bump
runs-on: ubuntu-latest
permissions:
contents: write
env:
PUBLISH_VERSION: ${{ github.event.inputs.version }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
BRANCH: "main"
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions-rust-lang/setup-rust-toolchain@v1
- run: cargo install cargo-bump
- run: cargo bump ${{ env.PUBLISH_VERSION }}
- run: cargo build
- name: "Commit and Push"
run: |
git config user.name github-actions[bot]
git config user.email github-actions[bot]@users.noreply.github.com
git checkout ${{ env.BRANCH }}
git add .
git commit -m "v$PUBLISH_VERSION"
git push origin HEAD:refs/heads/${{ env.BRANCH }}
- name: "Create Release"
run: |
curl -X POST \
-H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
-H "Content-Type: application/json" \
-d '{
"tag_name": "v${{ env.PUBLISH_VERSION }}",
"target_commitish": "${{ env.BRANCH }}",
"name": "v${{ env.PUBLISH_VERSION }}",
"body": "",
"draft": true,
"prerelease": false
}' \
https://api.github.com/repos/${{ github.repository }}/releases

0 comments on commit dfec1a1

Please sign in to comment.