[WIP] add github workflow build #11
Workflow file for this run
This file contains hidden or 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 | |
| on: | |
| schedule: | |
| # build every day at midnight | |
| - cron: '0 0 * * *' | |
| push: | |
| pull_request: | |
| branches: [ master ] | |
| workflow_dispatch: | |
| jobs: | |
| webdevops-toolbox-latest: | |
| runs-on: ubuntu-latest | |
| # container: webdevops/dockerfile-build-env # not needed and way faster if not used | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: docker/setup-qemu-action@v3 | |
| - uses: docker/setup-buildx-action@v3 | |
| - | |
| if: github.ref == 'refs/heads/github-actions' | |
| name: Login to ghcr.io | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - | |
| if: github.ref == 'refs/heads/github-actions' | |
| name: Login to hub.docker.com | |
| uses: docker/login-action@v3 | |
| with: | |
| username: ${{ secrets.DOCKERHUB_USERNAME }} | |
| password: ${{ secrets.DOCKERHUB_TOKEN }} | |
| - | |
| name: Build and push | |
| uses: docker/build-push-action@v6 | |
| with: | |
| context: docker/toolbox/latest | |
| push: ${{ github.ref == 'refs/heads/github-actions' }} | |
| tags: ghcr.io/webdevops/toolbox:latest,webdevops/toolbox:latest | |
| platforms: linux/amd64,linux/arm64 | |
| webdevops-bootstrap-alpine: | |
| needs: ['webdevops-toolbox-latest'] | |
| runs-on: ubuntu-latest | |
| container: webdevops/dockerfile-build-env | |
| strategy: | |
| matrix: | |
| platform: [ linux/amd64, linux/arm64 ] | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: docker/setup-qemu-action@v3 | |
| - uses: docker/setup-buildx-action@v3 | |
| - | |
| if: github.ref == 'refs/heads/github-actions' | |
| name: Login to ghcr.io | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - | |
| if: github.ref == 'refs/heads/github-actions' | |
| name: Login to hub.docker.com | |
| uses: docker/login-action@v3 | |
| with: | |
| username: ${{ secrets.DOCKERHUB_USERNAME }} | |
| password: ${{ secrets.DOCKERHUB_TOKEN }} | |
| - | |
| name: Build | |
| uses: docker/build-push-action@v6 | |
| with: | |
| context: docker/bootstrap/alpine | |
| load: true | |
| tags: webdevops/bootstrap:alpine | |
| platforms: ${{ matrix.platform }} | |
| - name: run serverspec | |
| run: | | |
| cd tests/serverspec | |
| echo "FROM webdevops/bootstrap:alpine" >> Dockerfile_696e41bf715e49.28746787 | |
| echo "COPY conf/ /" >> Dockerfile_696e41bf715e49.28746787 | |
| bundle install | |
| bash serverspec.sh spec/docker/bootstrap_spec.rb webdevops/bootstrap:alpine eyJET0NLRVJfSU1BR0UiOiJ3ZWJkZXZvcHNcL2Jvb3RzdHJhcDphbHBpbmUiLCJET0NLRVJfVEFHIjoiYWxwaW5lIiwiT1NfRkFNSUxZIjoiYWxwaW5lIiwiT1NfVkVSU0lPTiI6IiIsIkRPQ0tFUkZJTEUiOiJEb2NrZXJmaWxlXzY5NmU0MWJmNzE1ZTQ5LjI4NzQ2Nzg3In0= Dockerfile_696e41bf715e49.28746787 | |
| - name: run structure-test | |
| run: | | |
| cd tests/structure-test | |
| /usr/local/bin/container-structure-test test --image webdevops/bootstrap:alpine --config bootstrap/test.yaml --config bootstrap/alpine/test.yaml | |
| - | |
| if: github.ref == 'refs/heads/github-actions' | |
| name: push | |
| uses: docker/build-push-action@v6 | |
| with: | |
| context: docker/bootstrap/alpine | |
| push: true | |
| tags: ghcr.io/webdevops/bootstrap:alpine,webdevops/bootstrap:alpine | |
| platforms: ${{ matrix.platform }} |