modified: .github/workflows/build-image.yml #12
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: Publish Image | |
| on: | |
| push: | |
| env: | |
| REGISTRY: registry.cn-hangzhou.aliyuncs.com | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Check out the repo | |
| uses: actions/checkout@v4 | |
| - name: Log in to Docker Hub | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: ${{ env.REGISTRY }} | |
| username: ${{ secrets.REGISTRY_USER }} | |
| password: ${{ secrets.REGISTRY_PASS }} | |
| - name: Extract branch name | |
| shell: bash | |
| run: echo "branch=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}" >> $GITHUB_OUTPUT | |
| id: extract_branch | |
| - name: Build and push Docker image | |
| run: | | |
| docker build --build-arg TERRAFORM_VERSION=`echo ${{ steps.extract_branch.outputs.branch }} | awk -F "-" '{ print $1 }'` --build-arg TERRAGRUNT_VERSION=`echo ${{ steps.extract_branch.outputs.branch }} | awk -F "-" '{ print $2 }'` . --file Dockerfile --tag ${{ env.REGISTRY }}/goldenimage/terragrunt:${{ steps.extract_branch.outputs.branch }} | |
| docker push ${{ env.REGISTRY }}/goldenimage/terragrunt:${{ steps.extract_branch.outputs.branch }} | |
| - name: Wechat Work action | |
| uses: wertycn/work-wechat-send-action@main | |
| with: | |
| wechat_id: ${{ secrets.WECHAT_COMPANY_ID }} | |
| agent_secret: ${{ secrets.WECHAT_APP_SECRET }} | |
| agent_id: 1000003 | |
| to_user: 'suzhetao' | |
| msgtype: text | |
| send_step: post | |
| content: | | |
| from GitHub Actions | |
| repository: ${{ github.repository }} | |
| committer: ${{ github.actor }} | |
| branch: ${{ steps.extract_branch.outputs.branch }} | |
| compare: ${{ github.event.compare }} | |
| job status: ${{ job.status }} |