2117 auth header bug #1346
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
# GitHub Actions workflow for building and tagging the APP image on PR | |
name: React APP - Image Build on PR | |
on: | |
pull_request: | |
types: [opened, synchronize, ready_for_review] # Triggered by opened or changed pull requests. | |
branches: [main] | |
paths: | |
- 'react-app/**' # Triggers on changes to files in the frontend/ directory. | |
jobs: | |
# Job to build, tag, and push the APP image | |
PIMS-APP-Build-Tag-Push: | |
environment: dev | |
runs-on: ubuntu-latest | |
steps: | |
# Checkout the repository | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
# Login to the Openshift Cluster | |
- name: Login to Openshift | |
uses: redhat-actions/oc-login@v1 | |
with: | |
openshift_server_url: ${{ secrets.OPENSHIFT_SERVER_URL }} | |
openshift_token: ${{ secrets.OPENSHIFT_SA_TOOLS_TOKEN }} | |
namespace: ${{ secrets.OPENSHIFT_TOOLS_NAMESPACE }} | |
# Login to BC Gov Docker Image Repository | |
- name: Login to Openshift Docker | |
run : | | |
docker login ${{ secrets.PUBLIC_IMAGE_REPOSITORY }} -u ${{ secrets.OPENSHIFT_SA_NAME }} -p ${{ secrets.OPENSHIFT_SA_TOOLS_TOKEN }} | |
# Build the APP image | |
- name: Build APP Image | |
run: | | |
cd react-app && docker build -t ${{ secrets.PUBLIC_IMAGE_REPOSITORY }}/${{ secrets.OPENSHIFT_TOOLS_NAMESPACE }}/pims-app-v2:${{github.event.pull_request.number}} -f Dockerfile . | |
# Push the APP image | |
- name: Push APP Image | |
run: | | |
docker push ${{ secrets.PUBLIC_IMAGE_REPOSITORY }}/${{ secrets.OPENSHIFT_TOOLS_NAMESPACE }}/pims-app-v2:${{github.event.pull_request.number}} | |
# Job to update the wiki with the latest build image tag information | |
Update_Wiki_Tags: | |
needs: [PIMS-APP-Build-Tag-Push] | |
name: Update table in wiki | |
runs-on: ubuntu-latest | |
env: | |
GH_TOKEN: ${{ github.token }} | |
steps: | |
# Checkout the repository | |
- name: Checkout | |
uses: actions/checkout@v3 | |
# Clone wiki repository | |
- name: Clone wiki repository | |
run: | | |
echo "Cloning wiki repo https://github.com/$GITHUB_REPOSITORY.wiki.git" | |
git clone "https://$GITHUB_ACTOR:$GH_TOKEN@github.com/$GITHUB_REPOSITORY.wiki.git" ./wiki | |
# Setup Python | |
- name: Setup Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: '3.10' | |
# Run update wiki python script | |
- name: Run update wiki python script | |
run: python ./.github/helpers/update-wiki-table.py ./wiki/Image-tags.md "APP V2" "Latest Build Image Tag" "${{github.event.pull_request.number}}" | |
# Commit and push changes to wiki | |
- name: Commit and push changes to wiki | |
run: | | |
cd ./wiki | |
git config user.name "$GITHUB_ACTOR" | |
git config user.email "$GITHUB_ACTOR@users.noreply.github.com" | |
git add . | |
if git diff-index --quiet HEAD; then | |
echo "Nothing changed" | |
exit 0 | |
fi | |
echo "Pushing changes to wiki" | |
git commit -m "Value populated at image build App" && git push "https://$GITHUB_ACTOR:$GH_TOKEN@github.com/$GITHUB_REPOSITORY.wiki.git" | |
# Add Comment To the PR | |
- name: Add Comment To the PR | |
if: github.event.action == 'opened' | |
uses: actions/github-script@v6 | |
with: | |
script: | | |
github.rest.issues.createComment({ | |
issue_number: context.issue.number, | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
body: "🚀 **Deployment Information**\n\nThe React APP Image has been built with the tag: **`${{github.event.pull_request.number}}`**. Please make sure to utilize this specific tag when promoting these changes to the TEST and PROD environments during the APP deployment. For more updates please monitor [Image Tags](https://github.com/bcgov/PIMS/wiki/Image-tags) Page on Wiki." | |
}) | |