36 lines
1.7 KiB
YAML
36 lines
1.7 KiB
YAML
name: Build Container
|
|
run-name: Build Container
|
|
|
|
on:
|
|
push:
|
|
|
|
jobs:
|
|
docker:
|
|
name: Build Docker Container
|
|
runs-on: ubuntu-latest
|
|
container: docker
|
|
steps:
|
|
- run: |
|
|
git clone -b "${{github.ref_name}}" "URL=$(echo ${{github.server_url}}/${{github.repository}}.git | sed s%://%://${{github.token}}@% )" .
|
|
VERSION=$(cat Dockerfile | grep "ARG CADDY_VERSION" | grep -Eo '=.+' | grep -Eo '[[:alnum:]\.\/\-]+')
|
|
docker build -t ${{ github.server_url }}/${{ github.repository }}:$VERSION .
|
|
docker push ${{ github.server_url }}/${{ github.repository }}:$VERSION
|
|
|
|
docker tag ${{ github.server_url }}/${{ github.repository }}:${{ github.ref_name }} ${{ github.server_url }}/${{ github.repository }}:$VERSION
|
|
docker push ${{ github.server_url }}/${{ github.repository }}:${{ github.ref_name }}
|
|
|
|
[ '${{ github.ref_name }}' == 'master' ] && \
|
|
docker tag ${{ github.server_url }}/${{ github.repository }}:latest ${{ github.server_url }}/${{ github.repository }}:$VERSION && \
|
|
docker push ${{ github.server_url }}/${{ github.repository }}:latest || echo ''
|
|
|
|
tag:
|
|
name: Tag Version
|
|
runs-on: ubuntu-latest
|
|
container: node
|
|
steps:
|
|
- run: |
|
|
git clone -b "${{github.ref_name}}" "URL=$(echo ${{github.server_url}}/${{github.repository}}.git | sed s%://%://${{github.token}}@% )" .
|
|
VERSION=$(cat Dockerfile | grep "ARG CADDY_VERSION" | grep -Eo '=.+' | grep -Eo '[[:alnum:]\.\/\-]+')
|
|
tag -f $VERSION ${{github.sha}}
|
|
git push -f origin $VERSION
|