-
Notifications
You must be signed in to change notification settings - Fork 2
自動リリースworkflowを追加 #3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
y-chan
wants to merge
10
commits into
VirtualLiveLab:main
Choose a base branch
from
y-chan:ci/auto-release
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 8 commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
52e63ce
ci: add release workflow draft
sushichan044 91d293b
set unused version to pyproject
y-chan 7a978ee
add release workflow
y-chan 7253253
use 999.999.999 (ruf 200)
y-chan 188e2ad
fix miss
y-chan 377587a
fix miss
y-chan 868aa7b
add release note
y-chan 50dd10a
add contents write permission
y-chan 61cb804
appy suggestion
y-chan 8d708ae
specity os
y-chan File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,122 @@ | ||
| name: release | ||
|
|
||
| on: | ||
| # release: | ||
| # types: | ||
| # - created | ||
| workflow_dispatch: | ||
| inputs: | ||
| version: | ||
| description: "バージョン情報(A.B.C / A.B.C-preview.D)" | ||
| required: true | ||
| prerelease: | ||
| description: "プレリリースかどうか" | ||
| type: boolean | ||
| default: true | ||
|
|
||
| permissions: | ||
| contents: write | ||
|
|
||
| defaults: | ||
| run: | ||
| shell: bash | ||
|
|
||
| concurrency: | ||
| group: ${{ github.workflow }}-${{ github.ref }} | ||
| cancel-in-progress: true | ||
|
|
||
| jobs: | ||
| config: # 全 jobs で利用する定数の定義. `env` が利用できないコンテキストでも利用できる. | ||
| runs-on: ubuntu-latest | ||
| outputs: | ||
| version: ${{ steps.vars.outputs.version }} | ||
| version_or_latest: ${{ steps.vars.outputs.version_or_latest }} | ||
| steps: | ||
| - name: <Setup> Declare variables | ||
| id: vars | ||
| run: | | ||
| : # release タグ名, または workflow_dispatch でのバージョン名. リリースでない (push event) 場合は空文字列 | ||
| echo "version=${{ github.event.release.tag_name || github.event.inputs.version }}" >> "$GITHUB_OUTPUT" | ||
| : # release タグ名, または workflow_dispatch でのバージョン名, または '999.999.999' | ||
| echo "version_or_latest=${{ github.event.release.tag_name || github.event.inputs.version || '999.999.999' }}" >> "$GITHUB_OUTPUT" | ||
|
y-chan marked this conversation as resolved.
Outdated
|
||
|
|
||
| check: | ||
| runs-on: ubuntu-22.04 | ||
| steps: | ||
| - name: Check out the repository | ||
| uses: actions/checkout@v4 | ||
|
|
||
| - name: setup CPython | ||
| uses: actions/setup-python@v5 | ||
| with: | ||
| cache: "pip" | ||
| cache-dependency-path: "requirements-dev.lock" | ||
| python-version-file: ".python-version" | ||
|
|
||
| - name: install dependencies | ||
| id: install | ||
| run: | | ||
| python -m pip install --upgrade pip | ||
| pip install -r requirements-dev.lock | ||
|
|
||
| - name: lint | ||
| if: ${{ always() && steps.install.outcome == 'success' }} | ||
| run: | | ||
| ruff check --output-format github . | ||
|
|
||
| - name: format | ||
| if: ${{ always() && steps.install.outcome == 'success' }} | ||
| run: | | ||
| ruff format --check . | ||
|
|
||
| release: | ||
| runs-on: ubuntu-22.04 | ||
| needs: | ||
| - config | ||
| - check | ||
| steps: | ||
| - name: Check out the repository | ||
| uses: actions/checkout@v4 | ||
|
|
||
| - name: setup CPython | ||
| uses: actions/setup-python@v5 | ||
| with: | ||
| cache: "pip" | ||
| cache-dependency-path: "requirements.lock" | ||
| python-version-file: ".python-version" | ||
|
|
||
| - name: install dependencies | ||
| id: install | ||
| run: | | ||
| python -m pip install --upgrade pip | ||
| pip install -r requirements.lock | ||
|
|
||
| # ここから自動リリース用の処理を記述 | ||
| - name: Replace version | ||
| run: | | ||
| set -eux | ||
| sed -i "s/version = "999.999.999"/version = \"${{ needs.config.outputs.version_or_latest }}\"/" pyproject.toml | ||
|
y-chan marked this conversation as resolved.
Outdated
|
||
|
|
||
| - name: Extract package name | ||
| id: package_name | ||
| run: | | ||
| set -eux | ||
| PACKAGE_NAME=$(cat pyproject.toml | grep -xoE "name = \"(.*?)\"" | sed -r 's/name = "(.*?)"/\1/') | ||
|
sushichan044 marked this conversation as resolved.
Outdated
|
||
| echo "package_name=${PACKAGE_NAME}_${{ needs.config.outputs.version_or_latest }}" >> "$GITHUB_OUTPUT" | ||
|
|
||
| - name: Packaging | ||
| run: | | ||
| set -eux | ||
| zip -r ${{ steps.package_name.outputs.package_name }}.zip src/ pyproject.toml | ||
|
|
||
| - name: Create release | ||
| if: needs.config.outputs.version != '' | ||
| uses: ncipollo/release-action@v1 | ||
| with: | ||
| allowUpdates: true | ||
| prerelease: ${{ github.event.inputs.prerelease }} | ||
| token: ${{ secrets.GITHUB_TOKEN }} | ||
| tag: ${{ needs.config.outputs.version }} | ||
| artifacts: ${{ steps.package_name.outputs.package_name }}.zip | ||
| commit: ${{ github.sha }} | ||
| body: ${{ steps.tag_version.outputs.changelog }} | ||
|
y-chan marked this conversation as resolved.
Outdated
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.