mirror of
https://github.com/2revoemag/PSF-BotServer.git
synced 2026-01-19 18:14:44 +00:00
Merge pull request #866 from Mazo/publish-container
Fix publishing docker containers on push (tagged with sha for all pushes, master is tagged with sha, master, latest)
This commit is contained in:
commit
04e1f4209d
30
.github/workflows/publish-docs.yml
vendored
Normal file
30
.github/workflows/publish-docs.yml
vendored
Normal file
|
|
@ -0,0 +1,30 @@
|
||||||
|
name: Publish Docs
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- master
|
||||||
|
jobs:
|
||||||
|
docs:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
- name: Cache SBT
|
||||||
|
uses: actions/cache@v2
|
||||||
|
with:
|
||||||
|
path: |
|
||||||
|
~/.ivy2/cache
|
||||||
|
~/.sbt
|
||||||
|
key: ${{ runner.os }}-sbt-${{ hashFiles('**/build.sbt') }}
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
- name: Setup Scala
|
||||||
|
uses: olafurpg/setup-scala@v12
|
||||||
|
- name: Build docs
|
||||||
|
run: sbt docs/unidoc
|
||||||
|
- name: Deploy to GitHub Pages
|
||||||
|
uses: JamesIves/github-pages-deploy-action@4.1.4
|
||||||
|
with:
|
||||||
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
BRANCH: gh-pages
|
||||||
|
FOLDER: docs/target/scala-2.13/unidoc
|
||||||
72
.github/workflows/publish.yaml
vendored
72
.github/workflows/publish.yaml
vendored
|
|
@ -1,48 +1,38 @@
|
||||||
name: Publish
|
name: Publish Docker Image
|
||||||
on: [push]
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- master
|
||||||
jobs:
|
jobs:
|
||||||
docs:
|
|
||||||
if: github.ref == 'refs/heads/master'
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- name: Checkout
|
|
||||||
uses: actions/checkout@v2
|
|
||||||
- name: Cache SBT
|
|
||||||
uses: actions/cache@v2
|
|
||||||
with:
|
|
||||||
path: |
|
|
||||||
~/.ivy2/cache
|
|
||||||
~/.sbt
|
|
||||||
key: ${{ runner.os }}-sbt-${{ hashFiles('**/build.sbt') }}
|
|
||||||
- name: Checkout
|
|
||||||
uses: actions/checkout@v2
|
|
||||||
- name: Setup Scala
|
|
||||||
uses: olafurpg/setup-scala@v12
|
|
||||||
- name: Build docs
|
|
||||||
run: sbt docs/unidoc
|
|
||||||
- name: Deploy to GitHub Pages
|
|
||||||
uses: JamesIves/github-pages-deploy-action@4.1.4
|
|
||||||
with:
|
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
BRANCH: gh-pages
|
|
||||||
FOLDER: docs/target/scala-2.13/unidoc
|
|
||||||
|
|
||||||
docker:
|
docker:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Set up Docker Buildx
|
||||||
uses: actions/checkout@v2
|
uses: docker/setup-buildx-action@v1
|
||||||
- name: Inject slug/short variables
|
|
||||||
uses: rlespinasse/github-slug-action@v2.x
|
|
||||||
- name: Set variables
|
- name: Set variables
|
||||||
|
id: prep
|
||||||
run: |
|
run: |
|
||||||
echo "REPOSITORY=$(echo $GITHUB_REPOSITORY | tr '[A-Z]' '[a-z]')" >> $GITHUB_ENV
|
DOCKER_IMAGE=server
|
||||||
- name: Build and push Docker image
|
REPOSITORY="$(echo $GITHUB_REPOSITORY | tr '[:upper:]' '[:lower:]')" # Repository name must be lowercase in image tags
|
||||||
uses: docker/build-push-action@v2.5.0
|
|
||||||
|
if [ "$GITHUB_EVENT_NAME" == "pull_request" ]; then
|
||||||
|
GITHUB_SHA=$(cat $GITHUB_EVENT_PATH | jq -r .pull_request.head.sha) # GITHUB_SHA is the merge SHA, not the head commit SHA in a PR, replace it.
|
||||||
|
fi
|
||||||
|
|
||||||
|
TAGS="ghcr.io/${REPOSITORY}/${DOCKER_IMAGE}:${GITHUB_SHA}"
|
||||||
|
if [ "${{ github.ref }}" = "refs/heads/master" ]; then
|
||||||
|
TAGS="$TAGS,ghcr.io/${REPOSITORY}/${DOCKER_IMAGE}:latest,ghcr.io/${REPOSITORY}/${DOCKER_IMAGE}:master"
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo ::set-output name=tags::${TAGS}
|
||||||
|
- name: Log in to GitHub Docker Registry
|
||||||
|
uses: docker/login-action@v1
|
||||||
with:
|
with:
|
||||||
username: ${{ github.actor }}
|
registry: ghcr.io
|
||||||
password: ${{ github.token }}
|
username: ${{ github.repository_owner }}
|
||||||
registry: docker.pkg.github.com
|
password: ${{ secrets.GITHUB_TOKEN }}
|
||||||
repository: ${{ env.REPOSITORY }}/server
|
- name: Build container image
|
||||||
tag_with_sha: true
|
uses: docker/build-push-action@v2
|
||||||
tag_with_ref: true
|
with:
|
||||||
|
push: true
|
||||||
|
tags: ${{ steps.prep.outputs.tags }}
|
||||||
7
.github/workflows/test.yaml
vendored
7
.github/workflows/test.yaml
vendored
|
|
@ -1,5 +1,10 @@
|
||||||
name: Test
|
name: Test
|
||||||
on: [push, pull_request]
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- master
|
||||||
|
pull_request:
|
||||||
|
types: [ opened, reopened, synchronize ]
|
||||||
jobs:
|
jobs:
|
||||||
test:
|
test:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
|
||||||
|
|
@ -10,8 +10,8 @@ FROM openjdk:18-slim
|
||||||
|
|
||||||
COPY --from=builder /PSF-LoginServer/server/target/pack/ /usr/local
|
COPY --from=builder /PSF-LoginServer/server/target/pack/ /usr/local
|
||||||
|
|
||||||
EXPOSE 51000
|
EXPOSE 51000/udp
|
||||||
EXPOSE 51001
|
EXPOSE 51001/udp
|
||||||
EXPOSE 51002
|
EXPOSE 51002/tcp
|
||||||
|
|
||||||
CMD ["psforever-server"]
|
CMD ["psforever-server"]
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue