earlier push build action was not triggered due to github action limitation. ``` An action in a workflow run can’t trigger a new workflow run. ``` so now, we'll use user personal toke to create tag so that push build action pick the user not github action who created the tag. Closes: https://github.com/rook/rook/issues/8580 Signed-off-by: subhamkrai <srai@redhat.com>
65 lines
2.1 KiB
YAML
65 lines
2.1 KiB
YAML
name: Push Image Build
|
|
on:
|
|
push:
|
|
branches:
|
|
- master
|
|
- release-*
|
|
workflow_run:
|
|
workflows: ["Tag"]
|
|
types: [completed]
|
|
|
|
defaults:
|
|
run:
|
|
# reference: https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#using-a-specific-shell
|
|
shell: bash --noprofile --norc -eo pipefail -x {0}
|
|
|
|
jobs:
|
|
push-image-to-container-registry:
|
|
runs-on: ubuntu-18.04
|
|
# github.repository == 'rook/rook': for running the test only in 'rook/rook' repo
|
|
# github.event_name == 'push': This is for any push to master or release branches
|
|
# github.event.workflow_run.conclusion == 'success': For the tagged workflow completion
|
|
if: |
|
|
github.repository == 'rook/rook' &&
|
|
(github.event_name == 'push' || github.event.workflow_run.conclusion == 'success')
|
|
steps:
|
|
- name: checkout
|
|
uses: actions/checkout@v2
|
|
with:
|
|
fetch-depth: 0
|
|
|
|
# docker/setup-qemu action installs QEMU static binaries, which are used to run builders for architectures other than the host.
|
|
- name: set up QEMU
|
|
uses: docker/setup-qemu-action@master
|
|
with:
|
|
platforms: all
|
|
|
|
- name: log in to container registry
|
|
uses: docker/login-action@v1
|
|
with:
|
|
username: ${{ secrets.DOCKER_USERNAME }}
|
|
password: ${{ secrets.DOCKER_PASSWORD }}
|
|
|
|
- name: Configure AWS Credentials
|
|
uses: aws-actions/configure-aws-credentials@v1
|
|
with:
|
|
aws-access-key-id: ${{ secrets.AWS_USR }}
|
|
aws-secret-access-key: ${{ secrets.AWS_PSW }}
|
|
aws-region: us-east-1
|
|
|
|
# creating custom env var
|
|
- name: set env
|
|
run: |
|
|
echo "BRANCH_NAME=${GITHUB_REF##*/}" >> $GITHUB_ENV
|
|
echo "GITHUB_REF"=${GITHUB_REF} >> $GITHUB_ENV
|
|
|
|
- name: build and release
|
|
env:
|
|
GIT_API_TOKEN: ${{ secrets.GIT_API_TOKEN }}
|
|
BRANCH_NAME: ${{ env.BRANCH_NAME }}
|
|
AWS_USR: ${{ secrets.AWS_USR }}
|
|
AWS_PSW: ${{ secrets.AWS_PSW }}
|
|
GITHUB_REF: $ {{ env.GITHUB_REF }}
|
|
run: |
|
|
tests/scripts/build-release.sh
|