diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
index 7b66fc0bb..4c9bff0c5 100644
--- a/.github/workflows/release.yml
+++ b/.github/workflows/release.yml
@@ -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#(.+?)#test#' pom.xml
+ sed -r -i "1,/version/s#(.+?)#${{ steps.tag_version.outputs.new_tag }}#" 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/upload-release-asset@v1.0.1
- env:
- GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+ uses: shogo82148/actions-upload-release-asset@v1.5.0
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