Trying new build strategy
This commit is contained in:
parent
37247ce478
commit
d0be16d47b
20
.github/workflows/build.yaml
vendored
20
.github/workflows/build.yaml
vendored
@ -13,20 +13,20 @@ jobs:
|
|||||||
- name: Build Container
|
- name: Build Container
|
||||||
run: |
|
run: |
|
||||||
git clone -b "${{github.ref_name}}" "$(echo ${{github.server_url}}/${{github.repository}}.git | sed s%://%://${{github.token}}@% )" .
|
git clone -b "${{github.ref_name}}" "$(echo ${{github.server_url}}/${{github.repository}}.git | sed s%://%://${{github.token}}@% )" .
|
||||||
REGISTRY=$(echo ${{github.server_url}} | sed s%http://%% | sed s%https://%% )
|
REGISTRY="$(echo ${{github.server_url}} | sed s%http://%% | sed s%https://%% )"
|
||||||
VERSION=$(cat Dockerfile | grep "ARG CADDY_VERSION" | grep -Eo '=.+' | grep -Eo '[[:alnum:]\.\/\-]+')
|
VERSION="$(cat Dockerfile | grep "ARG CADDY_VERSION" | grep -Eo '=.+' | grep -Eo '[[:alnum:]\.\/\-]+')"
|
||||||
|
|
||||||
docker login -u ${{repository_owner}} -p ${{secrets.DEPLOY_TOKEN}} $REGISTRY
|
|
||||||
|
|
||||||
docker build -t $REGISTRY/${{github.repository}}:${{ github.ref_name}} .
|
docker build -t $REGISTRY/${{github.repository}}:${{ github.ref_name}} .
|
||||||
|
docker login -u ${{github.repository_owner}} -p ${{secrets.DEPLOY_TOKEN}} $REGISTRY
|
||||||
docker push $REGISTRY/${{github.repository}}:${{ github.ref_name}}
|
docker push $REGISTRY/${{github.repository}}:${{ github.ref_name}}
|
||||||
|
|
||||||
docker tag $REGISTRY/${{github.repository}}:$VERSION $REGISTRY/${{github.repository}}:${{github.ref_name}}
|
if [ '${{github.ref_name}}' == 'master' ]; then
|
||||||
docker push $REGISTRY/${{github.repository}}:$VERSION
|
docker tag $REGISTRY/${{github.repository}}:$VERSION $REGISTRY/${{github.repository}}:${{github.ref_name}}
|
||||||
|
docker push $REGISTRY/${{github.repository}}:$VERSION
|
||||||
[ '${{github.ref_name}}' == 'master' ] && \
|
|
||||||
docker tag $REGISTRY/${{github.repository}}:latest $REGISTRY/${{github.repository}}:${{github.ref_name}} && \
|
docker tag $REGISTRY/${{github.repository}}:latest $REGISTRY/${{github.repository}}:${{github.ref_name}} && \
|
||||||
docker push $REGISTRY/${{github.repository}}:latest || echo ''
|
docker push $REGISTRY/${{github.repository}}:latest
|
||||||
|
fi
|
||||||
|
|
||||||
tag:
|
tag:
|
||||||
name: Git Tag
|
name: Git Tag
|
||||||
@ -36,7 +36,7 @@ jobs:
|
|||||||
- name: Git Tag
|
- name: Git Tag
|
||||||
run: |
|
run: |
|
||||||
git clone -b "${{github.ref_name}}" "$(echo ${{github.server_url}}/${{github.repository}}.git | sed s%://%://${{github.token}}@% )" .
|
git clone -b "${{github.ref_name}}" "$(echo ${{github.server_url}}/${{github.repository}}.git | sed s%://%://${{github.token}}@% )" .
|
||||||
VERSION=$(cat Dockerfile | grep "ARG CADDY_VERSION" | grep -Eo '=.+' | grep -Eo '[[:alnum:]\.\/\-]+')
|
VERSION="$(cat Dockerfile | grep "ARG CADDY_VERSION" | grep -Eo '=.+' | grep -Eo '[[:alnum:]\.\/\-]+')"
|
||||||
|
|
||||||
git tag -f $VERSION ${{github.sha}}
|
git tag -f $VERSION ${{github.sha}}
|
||||||
git push -f origin $VERSION
|
git push -f origin $VERSION
|
||||||
|
Loading…
x
Reference in New Issue
Block a user