Skip to content

Commit

Permalink
v1.15.2 - implement new ci [skip ci]
Browse files Browse the repository at this point in the history
  • Loading branch information
Eredrim committed Feb 17, 2021
1 parent ef8590e commit 7edee80
Show file tree
Hide file tree
Showing 3 changed files with 82 additions and 3 deletions.
24 changes: 24 additions & 0 deletions .github/workflows/deploy-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: Maven deploy release
on:
release:
types:
- published

jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Maven settings
uses: actions/setup-java@v1
with:
java-version: 1.8
server-id: eredrim
server-username: MAVEN_USERNAME
server-password: MAVEN_PASSWORD

- name: Deploy the package
run: mvn --batch-mode deploy -DaltDeploymentRepository="eredrim::default::https://repo.eredrim.fr/repository/maven-releases/"
env:
MAVEN_USERNAME: ${{ secrets.MVN_USER }}
MAVEN_PASSWORD: ${{ secrets.MVN_PASSWORD }}
55 changes: 55 additions & 0 deletions .github/workflows/deploy-snapshot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
name: Maven deploy snapshot
on:
push:
branches:
- master

jobs:
deploy:
if: "!contains(github.event.head_commit.message, '[release]') && !contains(github.event.head_commit.message, '[doc]')"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Maven settings
uses: actions/setup-java@v1
with:
java-version: 1.8
server-id: eredrim
server-username: MAVEN_USERNAME
server-password: MAVEN_PASSWORD

- name: Get project version number
run: |
mvn_version=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)
echo "mvn_version=${mvn_version}" >> $GITHUB_ENV
- name: Check if version already exists on repository
run: |
http_code=$(curl -s -o /dev/null -w "%{http_code}" https://repo.eredrim.fr/repository/maven-snapshots/net/slipcor/pvparena/${{ env.mvn_version }}/maven-metadata.xml)
echo "version_http_code=${http_code}" >> $GITHUB_ENV
- name: Calculate build version with metadata
if: ${{ env.version_http_code == 200 }}
run: |
curl https://repo.eredrim.fr/repository/maven-snapshots/net/slipcor/pvparena/${{ env.mvn_version }}/maven-metadata.xml -o metadata.xml
build_number=$(grep -oP '(?<=buildNumber>)[^<]+' "metadata.xml")
echo "build_version=$((build_number + 1))" >> $GITHUB_ENV
- name: Generate a new build version
if: ${{ env.version_http_code != 200 }}
run: echo "build_version=1" >> $GITHUB_ENV

- name: Deploy the package
run: mvn --batch-mode deploy -DbuildVersion=-b${{ env.build_version }} -DaltDeploymentRepository="eredrim::default::https://repo.eredrim.fr/repository/maven-snapshots/"
env:
MAVEN_USERNAME: ${{ secrets.MVN_USER }}
MAVEN_PASSWORD: ${{ secrets.MVN_PASSWORD }}

- name: Post discord notification
run: |
commits="${{ join(github.event.commits.*.message, '\n - ') }}"
avatar_url=https://github.githubassets.com/images/modules/logos_page/GitHub-Mark.png
bot_username="Build notification"
payload_json='{ "username": "'$bot_username'", "avatar_url": "'$avatar_url'", "content": "A new dev build of PVP arena is available! Download it by saving the attached file.", "embeds": [{"description": ":spiral_note_pad: **New commits:**\n\n - '$commits'"}] }'
curl -X POST ${{ secrets.DISCORD_WEBHOOK_URL }} -F payload_json="${payload_json}"
curl -X POST ${{ secrets.DISCORD_WEBHOOK_URL }} -F username="${bot_username}" -F avatar_url="${avatar_url}" -F file=@target/pvparena-${{ env.mvn_version }}-b${{ env.build_version }}.jar
6 changes: 3 additions & 3 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@ PVP Arena release version can be downloaded on following pages:
- [PVP Arena - SpigotMC](https://www.spigotmc.org/resources/pvp-arena.16584/)
- [Github releases page](https://github.com/Eredrim/pvparena/releases)

Development builds (experimental) can be downloaded on Jenkins:
- [Jenkins dev builds](https://ci.craftyn.com/view/Spigot%20PVP%20Arena/)
Development builds (experimental) can be downloaded on our discord:
- [Discord server](https://discord.gg/a8NhSsXKVQ) (channel #dev-builds)

***

Expand Down Expand Up @@ -84,7 +84,7 @@ Place PVP Arena `.jar` file in the plugin repository of your server and restart.

You can contact us to ask your questions or just discuss, you can go here:
- <img src="https://www.spigotmc.org/favicon.ico" height="16"></img> [Spigot Forums](https://www.spigotmc.org/threads/pvp-arena.113406/)
- <img src="https://discord.com/assets/07dca80a102d4149e9736d4b162cff6f.ico" height="16"></img> [Discord server](https://discord.gg/43nZYXZ)
- <img src="https://discord.com/assets/07dca80a102d4149e9736d4b162cff6f.ico" height="16"></img> [Discord server](https://discord.gg/a8NhSsXKVQ)

To report issues and make suggestion, please use our [Github issues page](https://github.com/Eredrim/pvparena/issues).

Expand Down

0 comments on commit 7edee80

Please sign in to comment.