githubactions #21
Workflow file for this run
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: pull request | |
on: | |
push: | |
branches: ["develop", "feature/*", "hotfix/*"] | |
workflow_dispatch: | |
permissions: | |
id-token: write | |
contents: read | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
env: | |
IMAGE_TAG: ${{ github.sha }} | |
steps: | |
- name: Checkout repo | |
uses: actions/checkout@v3 | |
- name: Checkout manifest repo | |
uses: actions/checkout@v3 | |
with: | |
repository: nautible/nautible-app-examples-manifest | |
path: nautible-app-examples-manifest | |
token: ${{ secrets.PAT }} | |
- name: pull request | |
id: pull-request | |
if: github.ref_name == 'develop' || startsWith(github.ref_name, 'hotfix/') | |
env: | |
TOKEN: ${{ secrets.PAT }} | |
BRANCH: ${{ github.ref_name }} | |
TAG: update-image-feature-${{ github.sha }} | |
APP_NAME: examples | |
ACR_REGISTRY: nautibledevacr.azurecr.io | |
run: | | |
cd $GITHUB_WORKSPACE/nautible-app-$APP_NAME-manifest | |
git fetch origin $BRANCH && git checkout $BRANCH | |
git checkout -b $TAG $BRANCH | |
sed -i 's/image: public.ecr.aws\/nautible\/nautible-app-'$APP_NAME'-java:\(.*\)/image: public.ecr.aws\/nautible\/nautible-app-'$APP_NAME'-java:'$IMAGE_TAG'/' ./nautible-app-$APP_NAME-manifest-java/overlays/aws/dev/$APP_NAME-deployment.yaml | |
sed -i 's/image: public.ecr.aws\/nautible\/nautible-app-'$APP_NAME'-go:\(.*\)/image: public.ecr.aws\/nautible\/nautible-app-'$APP_NAME'-go:'$IMAGE_TAG'/' ./nautible-app-$APP_NAME-manifest-go/overlays/aws/dev/$APP_NAME-deployment.yaml | |
sed -i 's/image: public.ecr.aws\/nautible\/nautible-app-'$APP_NAME'-node:\(.*\)/image: public.ecr.aws\/nautible\/nautible-app-'$APP_NAME'-node:'$IMAGE_TAG'/' ./nautible-app-$APP_NAME-manifest-node/overlays/aws/dev/$APP_NAME-deployment.yaml | |
sed -i 's/image: public.ecr.aws\/nautible\/nautible-app-'$APP_NAME'-python:\(.*\)/image: public.ecr.aws\/nautible\/nautible-app-'$APP_NAME'-python:'$IMAGE_TAG'/' ./nautible-app-$APP_NAME-manifest-python/overlays/aws/dev/$APP_NAME-deployment.yaml | |
sed -i 's/image: '$ACR_REGISTRY'\/nautible-app-'$APP_NAME'-java:\(.*\)/image: '$ACR_REGISTRY'\/nautible-app-'$APP_NAME'-java:'$IMAGE_TAG'/' ./nautible-app-$APP_NAME-manifest-java/overlays/azure/dev/$APP_NAME-deployment.yaml | |
sed -i 's/image: '$ACR_REGISTRY'\/nautible-app-'$APP_NAME'-go:\(.*\)/image: '$ACR_REGISTRY'\/nautible-app-'$APP_NAME'-go:'$IMAGE_TAG'/' ./nautible-app-$APP_NAME-manifest-go/overlays/azure/dev/$APP_NAME-deployment.yaml | |
sed -i 's/image: '$ACR_REGISTRY'\/nautible-app-'$APP_NAME'-node:\(.*\)/image: '$ACR_REGISTRY'\/nautible-app-'$APP_NAME'-node:'$IMAGE_TAG'/' ./nautible-app-$APP_NAME-manifest-node/overlays/azure/dev/$APP_NAME-deployment.yaml | |
sed -i 's/image: '$ACR_REGISTRY'\/nautible-app-'$APP_NAME'-python:\(.*\)/image: '$ACR_REGISTRY'\/nautible-app-'$APP_NAME'-python:'$IMAGE_TAG'/' ./nautible-app-$APP_NAME-manifest-python/overlays/azure/dev/$APP_NAME-deployment.yaml | |
git config user.name github-actions | |
git config user.email [email protected] | |
git add . | |
git commit -m "update manifest" | |
git push --set-upstream origin $TAG | |
curl -X POST -H "Accept: application/vnd.github.v3+json" -H "Authorization: token $TOKEN" "https://api.github.com/repos/nautible/nautible-app-$APP_NAME-manifest/pulls" -d '{"title": "new image deploy request", "head": "nautible:'$TAG'", "base": "'$BRANCH'"}' -o /dev/null -w 'httpstatus:%{http_code}\n' -s |