Skip to content
This repository has been archived by the owner on Aug 2, 2023. It is now read-only.

Commit

Permalink
Merge pull request #637 from book000/feat/release-action
Browse files Browse the repository at this point in the history
feat: release action
  • Loading branch information
book000 authored Jan 17, 2022
2 parents 770d9c6 + 9912c14 commit 78bb8b5
Showing 1 changed file with 26 additions and 28 deletions.
54 changes: 26 additions & 28 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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: |
Expand All @@ -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
Expand Down

0 comments on commit 78bb8b5

Please sign in to comment.