Trying new build strategy
This commit is contained in:
parent
2fdac10aa7
commit
4da66b1dec
29
.github/workflows/build.yaml
vendored
29
.github/workflows/build.yaml
vendored
@ -5,31 +5,36 @@ on:
|
|||||||
push:
|
push:
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
docker:
|
container:
|
||||||
name: Build Docker Container
|
name: Build Container
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
container: docker
|
container: docker
|
||||||
steps:
|
steps:
|
||||||
- run: |
|
- name: Build Container
|
||||||
|
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:]\.\/\-]+')
|
||||||
docker build -t ${{ github.server_url }}/${{ github.repository }}:$VERSION .
|
PREFIX=$(echo ${{github.server_url}} | sed s%http://%% | sed s%https://%% )
|
||||||
docker push ${{ github.server_url }}/${{ github.repository }}:$VERSION
|
|
||||||
|
docker build -t $PREFIX/${{ github.repository }}:${{ github.ref_name }} .
|
||||||
|
docker push $PREFIX/${{ github.repository }}:${{ github.ref_name }}
|
||||||
|
|
||||||
docker tag ${{ github.server_url }}/${{ github.repository }}:${{ github.ref_name }} ${{ github.server_url }}/${{ github.repository }}:$VERSION
|
docker tag $PREFIX/${{ github.repository }}:$VERSION $PREFIX/${{ github.repository }}:${{ github.ref_name }}
|
||||||
docker push ${{ github.server_url }}/${{ github.repository }}:${{ github.ref_name }}
|
docker push $PREFIX/${{ github.repository }}:$VERSION
|
||||||
|
|
||||||
[ '${{ github.ref_name }}' == 'master' ] && \
|
[ '${{ github.ref_name }}' == 'master' ] && \
|
||||||
docker tag ${{ github.server_url }}/${{ github.repository }}:latest ${{ github.server_url }}/${{ github.repository }}:$VERSION && \
|
docker tag $PREFIX/${{ github.repository }}:latest $PREFIX/${{ github.repository }}:${{ github.ref_name }} && \
|
||||||
docker push ${{ github.server_url }}/${{ github.repository }}:latest || echo ''
|
docker push $PREFIX/${{ github.repository }}:latest || echo ''
|
||||||
|
|
||||||
tag:
|
tag:
|
||||||
name: Tag Version
|
name: Git Tag
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
container: node
|
container: alpine/git
|
||||||
steps:
|
steps:
|
||||||
- run: |
|
- name: Git Tag
|
||||||
|
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:]\.\/\-]+')
|
||||||
|
|
||||||
tag -f $VERSION ${{github.sha}}
|
tag -f $VERSION ${{github.sha}}
|
||||||
git push -f origin $VERSION
|
git push -f origin $VERSION
|
||||||
|
Loading…
x
Reference in New Issue
Block a user