Skip to content

Draft: rust-0.1.0

Draft: rust-0.1.0 #2

name: "Draft New Release"
run-name: "Draft: ${{ github.event.inputs.project }}-${{ github.event.inputs.version }}"
on:
workflow_dispatch:
inputs:
project:
type: choice
options:
- "c"
- "csharp"
- "d"
- "java"
- "javascript"
- "php"
- "python"
- "rust"
required: true
version:
description: "eg. 0.1.0"
required: true
jobs:
apply-version-rust:
name: "Apply Version for: ${{ github.event.inputs.project }}"
runs-on: ubuntu-latest
if: ${{ github.event.inputs.project == 'rust' }}
env:
CWD: "./${{ github.event.inputs.project }}"
PROJECT: ${{ github.event.inputs.project }}
PUBLISH_VERSION: ${{ github.event.inputs.version }}
BRANCH: "main"
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions-rust-lang/setup-rust-toolchain@v1
- run: cargo install cargo-bump
working-directory: ${{ env.CWD }}
- run: cargo bump ${{ env.PUBLISH_VERSION }}
working-directory: ${{ env.CWD }}
- run: cargo build
working-directory: ${{ env.CWD }}
- 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 "$PROJECT$PUBLISH_VERSION"
git push origin HEAD:refs/heads/${{ env.BRANCH }}
draft-github-release:
name: "Draft GitHub Release"
runs-on: ubuntu-latest
needs: [apply-version-rust]
permissions:
contents: write
env:
PROJECT: ${{ github.event.inputs.project }}
PUBLISH_VERSION: ${{ github.event.inputs.version }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
BRANCH: "main"
steps:
- name: "Create Release"
run: |
curl -X POST \
-H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
-H "Content-Type: application/json" \
-d '{
"tag_name": "${{ env.PROJECT }}-${{ env.PUBLISH_VERSION }}",
"target_commitish": "${{ env.BRANCH }}",
"name": "${{ env.PROJECT }}-${{ env.PUBLISH_VERSION }}",
"body": "",
"draft": true,
"prerelease": false
}' \
https://api.github.com/repos/${{ github.repository }}/releases