Use unfollow endpoint instead of block and unblock #72
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
name: Build Release | |
on: | |
workflow_dispatch: | |
push: | |
branches: | |
- "master" | |
paths-ignore: | |
- '.gitignore' | |
- 'LICENSE' | |
- 'README.md' | |
env: | |
DOCKER_OWNER: ${{ github.repository_owner }} | |
DOCKER_CONTAINER: standalone | |
DOCKER_TAG: ${{ github.ref_name }} | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Validate Gradle Wrapper | |
uses: gradle/actions/wrapper-validation@v3 | |
- name: Set up JDK 17 | |
uses: actions/setup-java@v4 | |
with: | |
java-version: 17 | |
distribution: temurin | |
- name: Get previous build number | |
id: getPreviousBuild | |
run: | | |
PREVIOUS_TAG=$(git for-each-ref --sort=-version:refname --count 1 --format="%(refname:short)" "refs/tags/*") | |
echo result=${PREVIOUS_TAG} >> $GITHUB_OUTPUT | |
- name: Get current build number | |
id: getCurrentBuild | |
if: success() | |
env: | |
PREVIOUS_BUILD: ${{ steps.getPreviousBuild.outputs.result }} | |
run: echo result=$((++PREVIOUS_BUILD)) >> $GITHUB_OUTPUT | |
- name: Setup Gradle | |
uses: gradle/actions/setup-gradle@v3 | |
with: | |
gradle-home-cache-cleanup: true | |
- name: Build | |
run: ./gradlew build | |
env: | |
BUILD_NUMBER: ${{ steps.getCurrentBuild.outputs.result }} | |
- uses: actions/upload-artifact@v4 | |
if: success() | |
with: | |
name: MCXboxBroadcastExtension | |
path: bootstrap/geyser/build/libs/MCXboxBroadcastExtension.jar | |
if-no-files-found: error | |
- uses: actions/upload-artifact@v4 | |
if: success() | |
with: | |
name: MCXboxBroadcastStandalone | |
path: bootstrap/standalone/build/libs/MCXboxBroadcastStandalone.jar | |
if-no-files-found: error | |
- name: Bump version and push tag | |
id: tag_version | |
uses: mathieudutour/[email protected] | |
if: ${{ success() && github.ref_name == 'master' }} | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
tag_prefix: '' | |
custom_tag: ${{ steps.getCurrentBuild.outputs.result }} | |
- name: Generate release diff | |
if: ${{ success() && github.ref_name == 'master' }} | |
env: | |
BEGIN_COMMIT: ${{ steps.getPreviousBuild.outputs.result }} | |
END_COMMIT: ${{ steps.getCurrentBuild.outputs.result }} | |
run: git fetch --tags --force && git log --pretty=format:"* %s (%h)" ${BEGIN_COMMIT}..${END_COMMIT} > release_notes.md | |
- name: Create release | |
uses: ncipollo/release-action@v1 | |
if: ${{ success() && github.ref_name == 'master' }} | |
with: | |
artifacts: "bootstrap/geyser/build/libs/MCXboxBroadcastExtension.jar,bootstrap/standalone/build/libs/MCXboxBroadcastStandalone.jar,egg-m-c-xbox-broadcast.json" | |
allowUpdates: true | |
bodyFile: "release_notes.md" | |
draft: false | |
prerelease: false | |
name: Build ${{ steps.getCurrentBuild.outputs.result }} (${{ github.ref_name }}) | |
tag: ${{ steps.getCurrentBuild.outputs.result }} | |
token: ${{ secrets.GITHUB_TOKEN }} | |
docker-standalone: | |
needs: build | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Download artifacts | |
uses: actions/download-artifact@v4 | |
with: | |
name: MCXboxBroadcastStandalone | |
path: bootstrap/standalone/build/libs | |
- name: Fix Docker environment variables | |
run: | | |
# Make lowercase | |
echo "DOCKER_OWNER=$(echo $DOCKER_OWNER | tr '[A-Z]' '[a-z]')" >> $GITHUB_ENV | |
echo "DOCKER_CONTAINER=$(echo $DOCKER_CONTAINER | tr '[A-Z]' '[a-z]')" >> $GITHUB_ENV | |
echo "DOCKER_TAG=$(echo $DOCKER_TAG | tr '[A-Z]' '[a-z]')" >> $GITHUB_ENV | |
# Replace / with _ | |
echo "DOCKER_TAG=$(echo $DOCKER_TAG | sed -e 's/\//_/g')" >> $GITHUB_ENV | |
- name: Build the Docker image | |
run: | | |
docker build . --file bootstrap/standalone/Dockerfile --tag $DOCKER_CONTAINER:$DOCKER_TAG | |
[[ "${{ github.ref }}" == "refs/heads/master" ]] && docker tag $DOCKER_CONTAINER:$DOCKER_TAG ghcr.io/$DOCKER_OWNER/$DOCKER_CONTAINER:latest | |
docker tag $DOCKER_CONTAINER:$DOCKER_TAG ghcr.io/$DOCKER_OWNER/$DOCKER_CONTAINER:$DOCKER_TAG | |
- name: Log in to registry | |
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u $ --password-stdin | |
- name: Push to GHCR | |
run: | | |
[[ "${{ github.ref }}" == "refs/heads/master" ]] && docker push ghcr.io/$DOCKER_OWNER/$DOCKER_CONTAINER:latest | |
docker push ghcr.io/$DOCKER_OWNER/$DOCKER_CONTAINER:$DOCKER_TAG |