Update changelog #105
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: CICD | |
| on: | |
| push: | |
| tags: [ "*" ] | |
| branches: [ "main" ] | |
| workflow_dispatch: | |
| env: | |
| DOCKERHUB_REPOSITORY: opositatest/php-fpm | |
| jobs: | |
| test: | |
| uses: ./.github/workflows/test.yml | |
| secrets: inherit | |
| build: | |
| needs: test | |
| name: ${{ matrix.os }}, ${{ matrix.arch }} | |
| runs-on: [ "${{ matrix.os }}-${{ matrix.arch }}" ] | |
| timeout-minutes: 20 | |
| strategy: | |
| matrix: | |
| os: [ public-ubuntu-latest ] | |
| arch: [ amd64, arm64 ] | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: docker/login-action@v3 | |
| with: | |
| username: ${{ secrets.DOCKERHUB_USERNAME }} | |
| password: ${{ secrets.DOCKERHUB_PASSWORD }} | |
| - name: Get the version | |
| id: get_version | |
| run: echo "version=${GITHUB_REF/refs\/tags\//}" >> $GITHUB_ENV | |
| - name: Check if latest | |
| id: latest | |
| if: github.event_name == 'push' && github.ref == 'refs/heads/main' | |
| run: echo "version=latest" >> $GITHUB_ENV | |
| - name: Build, tag and push image to Docker Hub and ECR | |
| id: build | |
| run: | | |
| docker build -t ${DOCKERHUB_REPOSITORY}:${version}-${{ matrix.arch }} . | |
| docker push ${DOCKERHUB_REPOSITORY}:${version}-${{ matrix.arch }} | |
| merge: | |
| runs-on: ubuntu-latest | |
| needs: | |
| - build | |
| steps: | |
| - name: Login to Docker Hub | |
| uses: docker/login-action@v3 | |
| with: | |
| username: ${{ secrets.DOCKERHUB_USERNAME }} | |
| password: ${{ secrets.DOCKERHUB_PASSWORD }} | |
| - name: Get the version | |
| id: get_version | |
| run: echo "version=${GITHUB_REF/refs\/tags\//}" >> $GITHUB_ENV | |
| - name: Check if latest | |
| id: latest | |
| if: github.event_name == 'push' && github.ref == 'refs/heads/main' | |
| run: echo "version=latest" >> $GITHUB_ENV | |
| - name: Tag and push merged image to Docker Hub | |
| run: | | |
| docker buildx imagetools create -t ${DOCKERHUB_REPOSITORY}:${version} \ | |
| ${DOCKERHUB_REPOSITORY}:${version}-amd64 \ | |
| ${DOCKERHUB_REPOSITORY}:${version}-arm64 |