mirror of
https://github.com/jambonz/jambonz-feature-server.git
synced 2026-02-09 02:30:17 +00:00
Compare commits
2 Commits
v0.8.5-25
...
testbuild-
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
dcd8b378b2 | ||
|
|
552a4e9fd1 |
54
.github/workflows/docker-publish.yml
vendored
54
.github/workflows/docker-publish.yml
vendored
@@ -2,13 +2,8 @@ name: Docker
|
|||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
# Publish `main` as Docker `latest` image.
|
|
||||||
branches:
|
|
||||||
- main
|
|
||||||
|
|
||||||
# Publish `v1.2.3` tags as releases.
|
|
||||||
tags:
|
tags:
|
||||||
- v*
|
- '*'
|
||||||
|
|
||||||
env:
|
env:
|
||||||
IMAGE_NAME: feature-server
|
IMAGE_NAME: feature-server
|
||||||
@@ -20,32 +15,37 @@ jobs:
|
|||||||
if: github.event_name == 'push'
|
if: github.event_name == 'push'
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- name: Checkout code
|
||||||
|
uses: actions/checkout@v3
|
||||||
|
|
||||||
- name: Build image
|
- name: Login to Docker Hub
|
||||||
run: docker build . --file Dockerfile --tag $IMAGE_NAME
|
uses: docker/login-action@v2
|
||||||
|
with:
|
||||||
|
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||||
|
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||||
|
|
||||||
- name: Log into registry
|
- name: prepare tag
|
||||||
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin
|
|
||||||
|
|
||||||
- name: Push image
|
|
||||||
run: |
|
run: |
|
||||||
IMAGE_ID=ghcr.io/${{ github.repository_owner }}/$IMAGE_NAME
|
IMAGE_ID=jambonz/$IMAGE_NAME
|
||||||
|
|
||||||
# Change all uppercase to lowercase
|
# Strip git ref prefix from version
|
||||||
IMAGE_ID=$(echo $IMAGE_ID | tr '[A-Z]' '[a-z]')
|
VERSION=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,')
|
||||||
|
|
||||||
# Strip git ref prefix from version
|
# Strip "v" prefix from tag name
|
||||||
VERSION=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,')
|
[[ "${{ github.ref }}" == "refs/tags/"* ]] && VERSION=$(echo $VERSION | sed -e 's/^v//')
|
||||||
|
|
||||||
# Strip "v" prefix from tag name
|
# Use Docker `latest` tag convention
|
||||||
[[ "${{ github.ref }}" == "refs/tags/"* ]] && VERSION=$(echo $VERSION | sed -e 's/^v//')
|
[ "$VERSION" == "main" ] && VERSION=latest
|
||||||
|
|
||||||
# Use Docker `latest` tag convention
|
echo IMAGE_ID=$IMAGE_ID
|
||||||
[ "$VERSION" == "main" ] && VERSION=latest
|
echo VERSION=$VERSION
|
||||||
|
|
||||||
echo IMAGE_ID=$IMAGE_ID
|
- name: Build and push Docker image
|
||||||
echo VERSION=$VERSION
|
uses: docker/build-push-action@v4
|
||||||
|
with:
|
||||||
docker tag $IMAGE_NAME $IMAGE_ID:$VERSION
|
context: .
|
||||||
docker push $IMAGE_ID:$VERSION
|
push: true
|
||||||
|
tags: jambonz/$IMAGE_NAME:$VERSION
|
||||||
|
build-args: |
|
||||||
|
GITHUB_REPOSITORY=$GITHUB_REPOSITORY
|
||||||
|
GITHUB_REF=$GITHUB_REF
|
||||||
|
|||||||
Reference in New Issue
Block a user