mirror of https://github.com/dirtbags/moth.git
Maybe smart image tags?
This commit is contained in:
parent
cf34a1a3be
commit
34e806df96
|
@ -32,23 +32,11 @@ jobs:
|
||||||
- name: Retrieve code
|
- name: Retrieve code
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v2
|
||||||
|
|
||||||
- name: Get current branch
|
- name: Gitlab variables
|
||||||
id: vars
|
id: vars
|
||||||
run: |
|
run: build/ci/gitlab-vars
|
||||||
echo "GITHUB_REF: $GITHUB_REF"
|
|
||||||
case $GITHUB_REF in
|
|
||||||
refs/tags/*)
|
|
||||||
TAGS=latest,${GITHUB_REF#refs/tags/}
|
|
||||||
;;
|
|
||||||
refs/heads/master)
|
|
||||||
TAGS=latest
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
echo "tags: $TAGS"
|
|
||||||
echo "::set-output name=tags::$TAGS"
|
|
||||||
|
|
||||||
- name: Login to GitHub Packages Docker Registry
|
- name: Login to GitHub Packages Docker Registry
|
||||||
if: steps.vars.tags != ''
|
|
||||||
uses: docker/login-action@v1
|
uses: docker/login-action@v1
|
||||||
with:
|
with:
|
||||||
registry: docker.pkg.github.com
|
registry: docker.pkg.github.com
|
||||||
|
@ -56,7 +44,6 @@ jobs:
|
||||||
password: ${{ secrets.GITHUB_TOKEN }}
|
password: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|
||||||
- name: Login to DockerHub
|
- name: Login to DockerHub
|
||||||
if: steps.vars.tags != ''
|
|
||||||
uses: docker/login-action@v1
|
uses: docker/login-action@v1
|
||||||
with:
|
with:
|
||||||
username: neale
|
username: neale
|
||||||
|
@ -67,15 +54,14 @@ jobs:
|
||||||
with:
|
with:
|
||||||
target: moth
|
target: moth
|
||||||
file: build/package/Containerfile
|
file: build/package/Containerfile
|
||||||
tags: |
|
push: ${{ steps.vars.outputs.tags != '' }}
|
||||||
dirtbags/moth:latest
|
tags: ${{ steps.vars.outputs.moth-tags }}
|
||||||
docker.pkg.github.com/dirtbags/moth/moth:latest
|
|
||||||
|
|
||||||
- name: Build and push moth-devel image
|
- name: Build and push moth-devel image
|
||||||
uses: docker/build-push-action@v2
|
uses: docker/build-push-action@v2
|
||||||
with:
|
with:
|
||||||
target: moth
|
target: moth
|
||||||
file: build/package/Containerfile
|
file: build/package/Containerfile
|
||||||
tags: |
|
tags: ${{ steps.vars.outputs.devel-tags }}
|
||||||
dirtbags/moth-devel:latest
|
dirtbags/moth-devel:latest
|
||||||
docker.pkg.github.com/dirtbags/moth/moth-devel:latest
|
docker.pkg.github.com/dirtbags/moth/moth-devel:latest
|
||||||
|
|
|
@ -0,0 +1,25 @@
|
||||||
|
#! /bin/sh
|
||||||
|
|
||||||
|
case $1 in
|
||||||
|
-h|-help|--help)
|
||||||
|
echo "Usage: $0 TARGET"
|
||||||
|
echo
|
||||||
|
echo "Sets CI build variables for gitlab"
|
||||||
|
exit 1
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
branch=$(git symbolic-ref -q --short HEAD)
|
||||||
|
if [ "$branch" = "main" ]; then
|
||||||
|
branch=latest
|
||||||
|
fi
|
||||||
|
|
||||||
|
printf "Branch: %s\n" "$branch"
|
||||||
|
printf "::set-output name=branch::%s\n" "$branch"
|
||||||
|
printf "::set-output name=tag::%s\n" "$branch"
|
||||||
|
|
||||||
|
# I think it will use whichever comes last
|
||||||
|
git tag --points-at HEAD | while read tag; do
|
||||||
|
printf "Tag: %s\n" "$tag"
|
||||||
|
printf "::set-output name=tag::%s\n" "$tag"
|
||||||
|
done
|
Loading…
Reference in New Issue