This repository has been archived by the owner on Aug 2, 2023. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #637 from book000/feat/release-action
feat: release action
- Loading branch information
Showing
1 changed file
with
26 additions
and
28 deletions.
There are no files selected for viewing
This file contains 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 |
---|---|---|
|
@@ -13,14 +13,21 @@ jobs: | |
runs-on: ubuntu-latest | ||
if: github.event_name == 'workflow_dispatch' || github.event.pull_request.merged == true | ||
|
||
steps: | ||
- name: Get current date | ||
id: date | ||
run: echo "::set-output name=datetime::$(date +'%Y%m%d-%H%M%S')" | ||
outputs: | ||
version: ${{ steps.tag_version.outputs.new_tag }} | ||
release-url: ${{ steps.create_release.outputs.upload_url }} | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
|
||
- name: Bump version and push tag | ||
id: tag_version | ||
uses: mathieudutour/github-tag-action@v5 | ||
with: | ||
github_token: ${{ secrets.GITHUB_TOKEN }} | ||
default_bump: "minor" | ||
|
||
- name: Set up JDK 17 | ||
uses: actions/setup-java@v2 | ||
with: | ||
|
@@ -37,43 +44,35 @@ jobs: | |
- name: Sed Version | ||
run: | | ||
sed -r -i '1,/version/s#<version>(.+?)</version>#<version>test</version>#' pom.xml | ||
sed -r -i "1,/version/s#<version>(.+?)</version>#<version>${{ steps.tag_version.outputs.new_tag }}</version>#" pom.xml | ||
git diff | ||
- name: Build with Maven | ||
run: mvn -B package --file pom.xml | ||
|
||
- name: Set SHORT_SHA | ||
- name: Set PROJECT_NAME | ||
id: vars | ||
run: | | ||
echo "::set-output name=SHORT_SHA::$(git rev-parse --short HEAD)" | ||
echo "::set-output name=PROJECT_NAME::`TOP=$(git rev-parse --show-toplevel); echo ${TOP##*/}`" | ||
- name: Create a Release | ||
id: create_release | ||
- name: Build with Maven | ||
run: mvn -B package --file pom.xml | ||
|
||
- name: Publish release | ||
uses: actions/create-release@v1 | ||
id: create_release | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
tag_name: v${{ steps.date.outputs.datetime }} | ||
release_name: Release v${{ steps.date.outputs.datetime }} | ||
draft: false | ||
prerelease: true | ||
body: | | ||
${{ github.event.pull_request.body }} | ||
sha: [${{ steps.jaoweb-vars.outputs.SHORT_SHA }}](https://github.com/jaoafa/MyMaid4/commit/${{ steps.jaoweb-vars.outputs.SHORT_SHA }}) | ||
tag_name: ${{ steps.tag_version.outputs.new_tag }} | ||
release_name: Release ${{ steps.tag_version.outputs.new_tag }} | ||
body: ${{ steps.tag_version.outputs.changelog }} | ||
|
||
- name: Upload Release Asset | ||
uses: actions/[email protected] | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
uses: shogo82148/[email protected] | ||
with: | ||
upload_url: ${{ steps.create_release.outputs.upload_url }} | ||
asset_path: target/MyMaid4.jar | ||
asset_name: MyMaid4.jar | ||
asset_content_type: application/zip | ||
asset_path: target/*.jar | ||
|
||
- name: Released comment | ||
uses: actions/github-script@v4 | ||
uses: actions/github-script@v5 | ||
if: github.event_name == 'pull_request_target' | ||
with: | ||
script: | | ||
|
@@ -84,10 +83,9 @@ jobs: | |
body: `# リリースが完了しました\n\n${{ steps.create_release.outputs.html_url }}` | ||
}) | ||
deploy: | ||
deploy-production: | ||
runs-on: ubuntu-latest | ||
needs: release | ||
if: github.event.pull_request.merged == true | ||
|
||
steps: | ||
- name: Deploy | ||
|