Merge branch 'puppetlabs:main' into main #9
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Docker test and publish | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
build-and-publish: | |
env: | |
PUPPERWARE_ANALYTICS_STREAM: production | |
IS_LATEST: true | |
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }} | |
DOCKERHUB_PASSWORD: ${{ secrets.DOCKERHUB_PASSWORD }} | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@master | |
- name: Set up Ruby 2.6 | |
uses: ruby/setup-ruby@v1 | |
with: | |
ruby-version: '2.6' | |
- run: gem install bundler | |
- name: Build container | |
working-directory: docker | |
run: | | |
docker system prune --all --force --volumes | |
docker builder prune --force --keep-storage=10GB | |
make lint build test | |
- name: Publish container | |
working-directory: docker | |
run: | | |
docker login -u "$DOCKERHUB_USERNAME" -p "$DOCKERHUB_PASSWORD" | |
make publish | |
- name: Build release container | |
env: | |
IS_RELEASE: true | |
working-directory: docker | |
shell: bash {0} | |
run: | | |
make prep | |
if [ $? -eq 0 ]; then | |
make lint build test | |
else | |
echo "Skipping release container building and testing" | |
fi | |
- name: Publish release container | |
env: | |
IS_RELEASE: true | |
working-directory: docker | |
shell: bash {0} | |
run: | | |
make prep | |
if [ $? -eq 0 ]; then | |
make publish | |
else | |
echo "Skipping release container publishing" | |
fi |