mirror of
https://github.com/2revoemag/PSF-BotServer.git
synced 2026-07-15 16:34:39 +00:00
Fix publishing docker containers on push (tagged with sha for all pushes, master is tagged with sha, master, latest)
This commit is contained in:
parent
cada786010
commit
9135123895
1 changed files with 21 additions and 12 deletions
33
.github/workflows/publish.yaml
vendored
33
.github/workflows/publish.yaml
vendored
|
|
@ -30,19 +30,28 @@ jobs:
|
||||||
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:]')"
|
||||||
uses: docker/build-push-action@v2.5.0
|
|
||||||
|
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:
|
||||||
|
registry: ghcr.io
|
||||||
username: ${{ github.actor }}
|
username: ${{ github.actor }}
|
||||||
password: ${{ github.token }}
|
password: ${{ secrets.GITHUB_TOKEN }}
|
||||||
registry: docker.pkg.github.com
|
- name: Build container image
|
||||||
repository: ${{ env.REPOSITORY }}/server
|
uses: docker/build-push-action@v2
|
||||||
tag_with_sha: true
|
with:
|
||||||
tag_with_ref: true
|
push: true
|
||||||
|
tags: ${{ steps.prep.outputs.tags }}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue