Trying new build strategy
This commit is contained in:
parent
f4a99fd533
commit
39f8e24eb2
57
.github/workflows/build.yaml
vendored
57
.github/workflows/build.yaml
vendored
@ -5,51 +5,29 @@ on:
|
|||||||
push:
|
push:
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
version:
|
docker:
|
||||||
name: Get Version Number
|
name: Build Docker Container
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
container: node
|
container: docker
|
||||||
outputs:
|
|
||||||
VERSION: ${{ steps.extract-version.outputs.VERSION }}
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v3
|
||||||
|
|
||||||
- name: Extract Version
|
- name: Build Docker Container
|
||||||
id: extract-version
|
|
||||||
run: |
|
run: |
|
||||||
VERSION=$(cat Dockerfile | grep "ARG CADDY_VERSION" | grep -Eo '=.+' | grep -Eo '[[:alnum:]\.\/\-]+')
|
VERSION=$(cat Dockerfile | grep "ARG CADDY_VERSION" | grep -Eo '=.+' | grep -Eo '[[:alnum:]\.\/\-]+')
|
||||||
echo "VERSION=$VERSION" >> $GITHUB_ENV
|
docker build -t ${{ github.server_url }}/${{ github.repository }}:$VERSION .
|
||||||
echo "VERSION=$VERSION" >> $GITHUB_OUTPUT
|
docker push ${{ github.server_url }}/${{ github.repository }}:$VERSION
|
||||||
echo $VERSION
|
|
||||||
|
docker tag ${{ github.server_url }}/${{ github.repository }}:${{ github.ref_name }} ${{ github.server_url }}/${{ github.repository }}:$VERSION
|
||||||
publish:
|
docker push ${{ github.server_url }}/${{ github.repository }}:${{ github.ref_name }}
|
||||||
name: Build & Push Dockerfile
|
|
||||||
needs: version
|
[ '${{ github.ref_name }}' == 'master' ] && \
|
||||||
runs-on: ubuntu-latest
|
docker tag ${{ github.server_url }}/${{ github.repository }}:latest ${{ github.server_url }}/${{ github.repository }}:$VERSION && \
|
||||||
container: node
|
docker push ${{ github.server_url }}/${{ github.repository }}:latest || echo ''
|
||||||
steps:
|
|
||||||
- name: Checkout
|
|
||||||
uses: actions/checkout@v3
|
|
||||||
|
|
||||||
- name: Push Version
|
|
||||||
uses: ztimson/actions/.github/workflows/docker.yaml@develop
|
|
||||||
with:
|
|
||||||
name: ztimson/caddy-labels:${{ needs.version.outputs.VERSION }}
|
|
||||||
repository: ${{ github.server_url }}/${{ github.repository }}.git
|
|
||||||
pass: ${{ secrets.DEPLOY_TOKEN }}
|
|
||||||
|
|
||||||
- name: Push Latest
|
|
||||||
if: github.ref == 'refs/heads/master'
|
|
||||||
uses: ztimson/actions/.github/workflows/docker.yaml@develop
|
|
||||||
with:
|
|
||||||
name: ztimson/caddy-labels:latest
|
|
||||||
repository: ${{ github.server_url }}/${{ github.repository }}.git
|
|
||||||
pass: ${{ secrets.DEPLOY_TOKEN }}
|
|
||||||
|
|
||||||
tag:
|
tag:
|
||||||
name: Tag Version
|
name: Tag Version
|
||||||
needs: [version, publish]
|
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
container: node
|
container: node
|
||||||
steps:
|
steps:
|
||||||
@ -57,6 +35,7 @@ jobs:
|
|||||||
uses: ztimson/actions/clone@develop
|
uses: ztimson/actions/clone@develop
|
||||||
|
|
||||||
- name: Tag Version
|
- name: Tag Version
|
||||||
uses: ztimson/actions/tag@develop
|
run: |
|
||||||
with:
|
VERSION=$(cat Dockerfile | grep "ARG CADDY_VERSION" | grep -Eo '=.+' | grep -Eo '[[:alnum:]\.\/\-]+')
|
||||||
tag: ${{ needs.version.outputs.VERSION }}
|
tag -f $VERSION ${{github.sha}}
|
||||||
|
git push -f origin $VERSION
|
||||||
|
Loading…
x
Reference in New Issue
Block a user