build: sync common files from github_organization_management repository #236
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: CI | |
on: | |
push: | |
branches: | |
- master | |
- integration | |
- experimental* | |
- release_* | |
repository_dispatch: | |
types: | |
- metwork-trigger* | |
env: | |
WORKFLOW_SCRIPTS_DIR: .github/workflows | |
DOCKER_WORKFLOW_SCRIPTS_DIR: /src/.github/workflows | |
PAYLOAD_BRANCH: ${{ github.event.client_payload.branch}} | |
PAYLOAD_OS: ${{ github.event.client_payload.os}} | |
jobs: | |
ci_build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: checkout | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
ref: ${{ github.event.client_payload.branch || github.ref }} | |
- name: set variables | |
id: SetVariables | |
run: | | |
${WORKFLOW_SCRIPTS_DIR}/set_variables.sh | |
- name: debug env | |
run: | | |
env | |
echo "Dockerfile" | |
cat ./Dockerfile | |
- name: docker build and push | |
id: DockerStep | |
env: | |
BRANCH: ${{ steps.SetVariables.outputs.branch }} | |
CACHEBUST: ${{ github.run_number }} | |
TAG_BRANCH: ${{ steps.SetVariables.outputs.tag_branch }} | |
TAG_LATEST: ${{ steps.SetVariables.outputs.tag_latest }} | |
run: | | |
echo ${{ secrets.DOCKER_PASSWORD }} | docker login -u ${{ secrets.DOCKER_USERNAME }} --password-stdin | |
${WORKFLOW_SCRIPTS_DIR}/docker_build.sh | |
- name: dispatch mfext | |
if: ${{ github.event_name != 'pull_request' && steps.SetVariables.outputs.branch != 'null' && steps.DockerStep.outputs.dispatch_bypass == 'false' && steps.SetVariables.outputs.os == 'centos8' }} | |
uses: peter-evans/repository-dispatch@v2 | |
with: | |
token: ${{ secrets.METWORK_ACCESS_TOKEN }} | |
repository: metwork-framework/mfext | |
event-type: metwork-trigger-${{ steps.SetVariables.outputs.branch }} | |
client-payload: '{"branch": "${{ steps.SetVariables.outputs.branch }}", "os": "centos8"}' | |