Closed genebean closed 4 years ago
Probably shouldn’t push to Docker Hub unless it’s a push event to master either...
Probably shouldn’t push to Docker Hub unless it’s a push event to master either...
This is resolved too by switching to multiple workflow files.
CI won't pass on this until, at a minimum, the username secret mentioned in the top message is added.
For reference, here is a comparison of the two workflow files:
--- .github/workflows/build-test-push.yml 2020-02-26 14:16:12 +0000
+++ .github/workflows/build-test.yml 2020-02-26 14:22:36 +0000
@@ -1,10 +1,10 @@
-name: Build-Test-Push
+name: Build-Test
on:
- push:
- branches:
- - master
+ - pull_request
jobs:
- Build-Test-Push:
+ Build-Test:
+ # Everything below here should be identical to build-test-push.yml with one exception:
+ # the "Login to Docker Hub" and "Push Docker images" should have been removed.
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
@@ -36,12 +36,3 @@
run: |
docker inspect --format='{{json .Config.Labels}}' ${{ secrets.DOCKERHUB_USERNAME }}/puppet-dev-tools:latest
docker inspect --format='{{json .Config.Labels}}' ${{ secrets.DOCKERHUB_USERNAME }}/puppet-dev-tools:latest
- - name: Login to Docker Hub
- run: echo ${{ secrets.DOCKERHUB_PASSWORD }} | docker login -u ${{ secrets.DOCKERHUB_USERNAME }} --password-stdin
- - name: Push Docker images
- run: |
- docker push ${{ secrets.DOCKERHUB_USERNAME }}/puppet-dev-tools:$(date +"%F")-$(git rev-parse --short HEAD)
- docker push ${{ secrets.DOCKERHUB_USERNAME }}/puppet-dev-tools:latest
- docker push ${{ secrets.DOCKERHUB_USERNAME }}/puppet-dev-tools:gosu-$(date +"%F")-$(git rev-parse --short HEAD)
- docker push ${{ secrets.DOCKERHUB_USERNAME }}/puppet-dev-tools:gosu
Config changes needed to make this all work
DOCKERHUB_USERNAME
should be set topuppet
DOCKERHUB_PASSWORD
should be set to the access token generated on Docker Hub