Merge pull request #29 from ELDEpendenci/develop #122
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
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
name: Publish WorkFlows for ELDependenci | |
on: | |
push: | |
branches: [ master ] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
packages: read | |
steps: | |
- name: Checkout Source Code | |
id: checkout-source | |
uses: actions/checkout@v4 | |
- uses: actions/setup-java@v4 | |
with: | |
java-version: '17' | |
distribution: 'adopt' | |
- run: mvn --batch-mode clean package | |
name: build plugins | |
- run: echo ::set-output name=version::$(mvn help:evaluate -Dexpression=eld.plugin.version -q -DforceStdout) | |
id: project | |
- name: Delete existing release and tag | |
continue-on-error: true | |
id: delete-tag-release | |
run: gh release delete ${{ steps.project.outputs.version }} --yes --cleanup-tag | |
- name: zip plugins | |
run: zip -r plugins.zip outputs | |
- name: Create Release | |
id: create_release | |
uses: softprops/action-gh-release@v2 | |
with: | |
tag_name: ${{ steps.project.outputs.version }} | |
name: Release ${{ github.repository }} v${{ steps.project.outputs.version }} | |
body: 請到 [wiki](https://eric2788.gitbook.io/eldependenci/references/version-update) 查看更新內容 | |
files: plugins.zip | |
- name: 'Update javadocs' | |
run: | | |
git config --global pull.rebase false | |
git config --global user.name "Javadocs Generator Bot" | |
git config --global user.email "<>" | |
git checkout --orphan gh-pages | |
git rm -rf --cached . | |
git add -f javadocs/* | |
echo '<ul> | |
<li> | |
<a href="javadocs/eldependenci-addon">eldependenci-addon</a> | |
</li> | |
<li> | |
<a href="javadocs/eldependenci-bukkit">eldependenci-bukkit</a> | |
</li> | |
<li> | |
<a href="javadocs/eldependenci-bungee">eldependenci-bungee</a> | |
</li> | |
</ul>' > index.html | |
git add index.html | |
git commit -am "Update javadocs" | |
git push -uf origin gh-pages | |
upload_github_pkg: | |
runs-on: ubuntu-latest | |
needs: [build] | |
permissions: | |
contents: read | |
packages: write | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions-ecosystem/action-get-latest-tag@v1 | |
id: latest-tag | |
- uses: jungwinter/split@v2 | |
id: version | |
with: | |
msg: ${{ steps.latest-tag.outputs.tag }} | |
separator: '.' | |
- uses: actions/setup-java@v4 | |
with: | |
java-version: '17' | |
distribution: 'adopt' | |
- name: Publish package | |
run: mvn --batch-mode clean deploy | |
if: ${{ steps.version.outputs.length <= 3 }} | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |