mirror of
https://github.com/b4tman/docker-squid.git
synced 2024-11-26 05:06:54 +00:00
rewrite dockerimage workflow
This commit is contained in:
parent
0ca618e4a0
commit
a3b428e958
98
.github/workflows/dockerimage.yml
vendored
98
.github/workflows/dockerimage.yml
vendored
@ -2,42 +2,82 @@ name: Docker Image CI
|
|||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
|
# Publish `master` as Docker `latest` image.
|
||||||
branches:
|
branches:
|
||||||
- master
|
- master
|
||||||
- v3
|
|
||||||
- v4
|
# Publish `v1.2.3` tags as releases.
|
||||||
|
tags:
|
||||||
|
- v*
|
||||||
|
|
||||||
|
# Run tests for any PRs.
|
||||||
pull_request:
|
pull_request:
|
||||||
branches:
|
|
||||||
- master
|
|
||||||
- v3
|
|
||||||
- v4
|
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
test:
|
||||||
runs-on: ubuntu-18.04
|
runs-on: ubuntu-18.04
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v1
|
- uses: actions/checkout@v2
|
||||||
- name: Build the Docker image
|
|
||||||
|
- name: Build squid image
|
||||||
run: docker build . --file Dockerfile --tag b4tman/squid
|
run: docker build . --file Dockerfile --tag b4tman/squid
|
||||||
|
|
||||||
- name: Test image
|
- name: Test image
|
||||||
run: docker-compose -f docker-compose.test.yml up sut
|
run: docker-compose -f docker-compose.test.yml up sut
|
||||||
- name: Build 'ssl-bump' Docker image
|
|
||||||
|
- name: Build 'ssl-bump' image
|
||||||
run: docker build ssl-bump --tag b4tman/squid:ssl-bump
|
run: docker build ssl-bump --tag b4tman/squid:ssl-bump
|
||||||
- name: GituHub Packages - Docker Login
|
|
||||||
if: github.event_name == 'push'
|
push:
|
||||||
run: docker login docker.pkg.github.com -u b4tman -p ${{secrets.GITHUB_PKGS_TOKEN}}
|
needs: test
|
||||||
- name: GituHub Packages - Docker Tag
|
runs-on: ubuntu-18.04
|
||||||
if: github.event_name == 'push'
|
if: github.event_name == 'push'
|
||||||
run: docker tag b4tman/squid docker.pkg.github.com/${{github.repository}}/squid:$(echo ${{github.ref}} | sed 's/.*\/.*\///')
|
|
||||||
- name: GituHub Packages - Docker Tag 'ssl-bump'
|
- uses: actions/checkout@v2
|
||||||
if: github.event_name == 'push'
|
|
||||||
run: docker tag b4tman/squid:ssl-bump docker.pkg.github.com/${{github.repository}}/ssl-bump:$(echo ${{github.ref}} | sed 's/.*\/.*\///')
|
- name: Build squid image
|
||||||
- name: GituHub Packages - Docker Push
|
run: docker build . --file Dockerfile --tag b4tman/squid
|
||||||
if: github.event_name == 'push'
|
|
||||||
run: docker push docker.pkg.github.com/${{github.repository}}/squid:$(echo ${{github.ref}} | sed 's/.*\/.*\///')
|
- name: Build 'ssl-bump' image
|
||||||
- name: GituHub Packages - Docker Push 'ssl-bump'
|
run: docker build ssl-bump --tag b4tman/squid:ssl-bump
|
||||||
if: github.event_name == 'push'
|
|
||||||
run: docker push docker.pkg.github.com/${{github.repository}}/ssl-bump:$(echo ${{github.ref}} | sed 's/.*\/.*\///')
|
- name: Log into registry
|
||||||
- name: GituHub Packages - Docker Logout
|
run: echo "${{ secrets.GITHUB_PKGS_TOKEN }}" | docker login docker.pkg.github.com -u ${{ github.actor }} --password-stdin
|
||||||
if: github.event_name == 'push'
|
|
||||||
run: docker logout docker.pkg.github.com
|
- name: Push squid image
|
||||||
|
run: |
|
||||||
|
IMAGE_ID=docker.pkg.github.com/${{ github.repository }}/squid
|
||||||
|
|
||||||
|
# Strip git ref prefix from version
|
||||||
|
VERSION=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,')
|
||||||
|
|
||||||
|
# Strip "v" prefix from tag name
|
||||||
|
[[ "${{ github.ref }}" == "refs/tags/"* ]] && VERSION=$(echo $VERSION | sed -e 's/^v//')
|
||||||
|
|
||||||
|
# Use Docker `latest` tag convention
|
||||||
|
[ "$VERSION" == "master" ] && VERSION=latest
|
||||||
|
|
||||||
|
echo IMAGE_ID=$IMAGE_ID
|
||||||
|
echo VERSION=$VERSION
|
||||||
|
|
||||||
|
docker tag b4tman/squid $IMAGE_ID:$VERSION
|
||||||
|
docker push $IMAGE_ID:$VERSION
|
||||||
|
|
||||||
|
- name: Push 'ssl-bump' image
|
||||||
|
run: |
|
||||||
|
IMAGE_ID=docker.pkg.github.com/${{ github.repository }}/ssl-bump
|
||||||
|
|
||||||
|
# Strip git ref prefix from version
|
||||||
|
VERSION=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,')
|
||||||
|
|
||||||
|
# Strip "v" prefix from tag name
|
||||||
|
[[ "${{ github.ref }}" == "refs/tags/"* ]] && VERSION=$(echo $VERSION | sed -e 's/^v//')
|
||||||
|
|
||||||
|
# Use Docker `latest` tag convention
|
||||||
|
[ "$VERSION" == "master" ] && VERSION=latest
|
||||||
|
|
||||||
|
echo IMAGE_ID=$IMAGE_ID
|
||||||
|
echo VERSION=$VERSION
|
||||||
|
|
||||||
|
docker tag b4tman/squid:ssl-bump $IMAGE_ID:$VERSION
|
||||||
|
docker push $IMAGE_ID:$VERSION
|
||||||
|
Loading…
Reference in New Issue
Block a user