2019-09-04 06:38:16 +00:00
|
|
|
name: Docker Image CI
|
|
|
|
|
|
|
|
on:
|
|
|
|
push:
|
2020-02-02 15:51:35 +00:00
|
|
|
# Publish `master` as Docker `latest` image.
|
2019-09-04 06:38:16 +00:00
|
|
|
branches:
|
2020-02-02 15:51:35 +00:00
|
|
|
- master
|
2019-09-04 06:38:16 +00:00
|
|
|
|
2020-02-02 15:51:35 +00:00
|
|
|
# Publish `v1.2.3` tags as releases.
|
|
|
|
tags:
|
|
|
|
- v*
|
|
|
|
|
|
|
|
# Run tests for any PRs.
|
|
|
|
pull_request:
|
|
|
|
|
2019-09-04 06:38:16 +00:00
|
|
|
jobs:
|
2020-02-02 15:51:35 +00:00
|
|
|
test:
|
2019-09-04 06:38:16 +00:00
|
|
|
runs-on: ubuntu-18.04
|
|
|
|
steps:
|
2020-02-02 15:51:35 +00:00
|
|
|
- uses: actions/checkout@v2
|
|
|
|
|
|
|
|
- name: Build squid image
|
2019-09-24 12:46:08 +00:00
|
|
|
run: docker build . --file Dockerfile --tag b4tman/squid
|
2020-02-02 15:51:35 +00:00
|
|
|
|
2019-09-04 06:38:16 +00:00
|
|
|
- name: Test image
|
|
|
|
run: docker-compose -f docker-compose.test.yml up sut
|
2020-02-02 15:51:35 +00:00
|
|
|
|
|
|
|
- name: Build 'ssl-bump' image
|
|
|
|
run: docker build ssl-bump --tag b4tman/squid:ssl-bump
|
|
|
|
|
|
|
|
push:
|
|
|
|
needs: test
|
|
|
|
runs-on: ubuntu-18.04
|
|
|
|
if: github.event_name == 'push'
|
2020-02-02 15:55:25 +00:00
|
|
|
steps:
|
2020-02-02 15:51:35 +00:00
|
|
|
- uses: actions/checkout@v2
|
|
|
|
|
|
|
|
- name: Build squid image
|
|
|
|
run: docker build . --file Dockerfile --tag b4tman/squid
|
|
|
|
|
|
|
|
- name: Build 'ssl-bump' image
|
2019-09-24 12:46:08 +00:00
|
|
|
run: docker build ssl-bump --tag b4tman/squid:ssl-bump
|
2020-02-02 15:51:35 +00:00
|
|
|
|
|
|
|
- name: Log into registry
|
|
|
|
run: echo "${{ secrets.GITHUB_PKGS_TOKEN }}" | docker login docker.pkg.github.com -u ${{ github.actor }} --password-stdin
|
|
|
|
|
|
|
|
- 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
|