Added documentation on OpenShift agents #11
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: build react app with github actions | |
on: | |
workflow_dispatch: | |
push: | |
branches: | |
- main | |
jobs: | |
build-image: | |
runs-on: ubuntu-latest | |
env: | |
commitmsg: ${{ github.event.head_commit.message }} | |
steps: | |
- name: Set environment variables | |
run: | | |
echo "GIT_SHA=${GITHUB_SHA}" >> $GITHUB_ENV | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Setup Docker buildx | |
uses: docker/setup-buildx-action@v1 | |
- name: Login to Quay.io | |
uses: docker/login-action@v3 | |
with: | |
registry: ${{ secrets.QUAY_URL }} | |
username: ${{ secrets.QUAY_USERNAME }} | |
password: ${{ secrets.QUAY_ROBOT_TOKEN }} | |
- name: Build and Push image | |
uses: docker/build-push-action@v2 | |
with: | |
push: true | |
tags: ${{ secrets.QUAY_URL }}/anattama/my-web-react-app:${{ env.GIT_SHA }} | |
file: ./Dockerfile | |
- name: Checkout Manifest Repo | |
uses: actions/checkout@v4 | |
with: | |
repository: arunhari82/my-web-react-app-gitops | |
token: ${{ secrets.MANIFEST_REPO_PAT }} | |
persist-credentials: true | |
- name: Update Image Signature | |
shell: bash | |
run: | | |
sed -e 's/\(.*tag:\) \(.*\)/\1 ${{ env.GIT_SHA }}/g' ./helm/app/values.yaml > ./helm/app/values.yaml.temp | |
rm ./helm/app/values.yaml | |
mv ./helm/app/values.yaml.temp ./helm/app/values.yaml | |
- name: Commit files # transfer the new html files back into the repository | |
run: | | |
git config --local user.email "73549783+arunhari82@users.noreply.github.com" | |
git config --local user.name "arunhari82" | |
git add ./helm/app/values.yaml | |
git commit -m "${{ env.GIT_SHA }} - ${{env.commitmsg}}" | |
- name: Push changes to Manifest Repo # push the output folder to your repo | |
uses: ad-m/github-push-action@master | |
with: | |
repository: arunhari82/my-web-react-app-gitops | |
github_token: ${{ secrets.MANIFEST_REPO_PAT }} | |