Added actions
This commit is contained in:
parent
96e1d23396
commit
19b2c197ad
43
.gitlab/workflows/build.yml
Normal file
43
.gitlab/workflows/build.yml
Normal file
@ -0,0 +1,43 @@
|
||||
name: Build Container
|
||||
run-name: Build Container
|
||||
|
||||
on:
|
||||
push:
|
||||
|
||||
jobs:
|
||||
container:
|
||||
name: Build Container
|
||||
runs-on: ubuntu-latest
|
||||
container: docker
|
||||
steps:
|
||||
- name: Build Container
|
||||
run: |
|
||||
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://%% )"
|
||||
VERSION="$(cat Dockerfile | grep "ARG CADDY_VERSION" | grep -Eo '=.+' | grep -Eo '[[:alnum:]\.\/\-]+')"
|
||||
|
||||
docker login -u ${{github.repository_owner}} -p ${{secrets.DEPLOY_TOKEN}} $REGISTRY
|
||||
|
||||
docker build -t $REGISTRY/${{github.repository}}:${{github.ref_name}} .
|
||||
docker push $REGISTRY/${{github.repository}}:${{github.ref_name}}
|
||||
|
||||
if [ '${{github.ref_name}}' == 'master' ]; then
|
||||
docker tag $REGISTRY/${{github.repository}}:${{github.ref_name}} $REGISTRY/${{github.repository}}:$VERSION
|
||||
docker push $REGISTRY/${{github.repository}}:$VERSION
|
||||
|
||||
docker tag $REGISTRY/${{github.repository}}:${{github.ref_name}} $REGISTRY/${{github.repository}}:latest
|
||||
docker push $REGISTRY/${{github.repository}}:latest
|
||||
fi
|
||||
|
||||
tag:
|
||||
name: Git Tag
|
||||
runs-on: ubuntu-latest
|
||||
container: alpine/git
|
||||
steps:
|
||||
- name: Git Tag
|
||||
run: |
|
||||
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:]\.\/\-]+')"
|
||||
|
||||
git tag -f $VERSION ${{github.sha}}
|
||||
git push -f origin $VERSION
|
Loading…
x
Reference in New Issue
Block a user