Merge pull request #17 from infracloudio/fix/slo #16
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: Build And Push | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
types: [opened] | |
branches: | |
- 'main' | |
workflow_dispatch: | |
permissions: | |
contents: "read" | |
id-token: "write" | |
packages: "write" | |
jobs: | |
build-and-push-ghcr: | |
runs-on: ubuntu-latest | |
env: | |
codebundle: rds-mysql-conn-count | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
- name: Build | |
run: |- | |
docker build \ | |
-t "ghcr.io/${{ github.repository }}:latest" \ | |
-t "ghcr.io/${{ github.repository }}:main" \ | |
-f Dockerfile . | |
- name: Smoke Test Build | |
run: | | |
docker run -d -p 3000:3000 --name mycodecollection ghcr.io/${{ github.repository }}:latest | |
docker exec mycodecollection bash -c "ro /app/codecollection/codebundles/${{ env.codebundle }}/sli.robot && ls -R /robot_logs" | |
curl --fail-with-body http://localhost:3000/${{ env.codebundle }}/sli-log.html | |
- name: Push | |
run: | | |
echo "${{ secrets.GITHUB_TOKEN }}" | docker login --username ${{ github.actor }} --password-stdin ghcr.io | |
docker push ghcr.io/${{ github.repository }} --all-tags |