-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
241 additions
and
4 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,233 @@ | ||
name: Build dev on develop & main branch push (GOLD) | ||
|
||
on: | ||
push: | ||
branches: | ||
- alpha | ||
- main | ||
|
||
concurrency: | ||
group: build-dev-gold-${{ github.ref_name }} | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
build-cms: | ||
runs-on: ubuntu-latest | ||
env: | ||
IMAGE_NAME: strapi-${{ github.ref_name }} | ||
BUILDER_IMAGE: registry.access.redhat.com/ubi8/nodejs-18:1-32 | ||
steps: | ||
- name: Git Checkout | ||
uses: actions/checkout@v3 | ||
|
||
- name: Set env | ||
run: echo "SHORT_SHA=$(git rev-parse --short HEAD)" >> $GITHUB_ENV | ||
|
||
- name: Login to OpenShift Container Repository | ||
uses: docker/login-action@v2 | ||
with: | ||
registry: ${{secrets.OPENSHIFT_GOLD_EXTERNAL_REPOSITORY}} | ||
username: ${{secrets.OPENSHIFT_GOLD_SA_USERNAME}} | ||
password: ${{secrets.OPENSHIFT_GOLD_SA_PASSWORD}} | ||
|
||
- name: s2i Build | ||
id: build_image | ||
uses: redhat-actions/s2i-build@v2 | ||
with: | ||
path_context: "src/cms" | ||
builder_image: ${{ env.BUILDER_IMAGE }} | ||
image: ${{ secrets.OPENSHIFT_GOLD_EXTERNAL_REPOSITORY }}/${{ secrets.OPENSHIFT_GOLD_LICENSE_PLATE }}-tools/${{ env.IMAGE_NAME }} | ||
tags: latest ${{ env.SHORT_SHA }} | ||
env_vars: STRAPI_ADMIN_BACKEND_URL= | ||
|
||
- name: Push Docker image | ||
run: docker push --all-tags ${{ steps.build_image.outputs.image }} | ||
|
||
build-admin: | ||
runs-on: ubuntu-latest | ||
env: | ||
IMAGE_NAME: admin-${{ github.ref_name }} | ||
steps: | ||
- name: Git Checkout | ||
uses: actions/checkout@v3 | ||
|
||
- name: Set env | ||
run: | | ||
echo "SHORT_SHA=$(git rev-parse --short HEAD)" >> $GITHUB_ENV | ||
echo "REGISTRY_IMAGE=${{ secrets.OPENSHIFT_GOLD_EXTERNAL_REPOSITORY }}/${{ secrets.OPENSHIFT_GOLD_LICENSE_PLATE }}-tools/${{ env.IMAGE_NAME }}" >> $GITHUB_ENV | ||
- name: Login to OpenShift Container Repository | ||
uses: docker/login-action@v2 | ||
with: | ||
registry: ${{secrets.OPENSHIFT_GOLD_EXTERNAL_REPOSITORY}} | ||
username: ${{secrets.OPENSHIFT_GOLD_SA_USERNAME}} | ||
password: ${{secrets.OPENSHIFT_GOLD_SA_PASSWORD}} | ||
|
||
- name: Setup Node | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: "18" | ||
|
||
- name: npm build | ||
run: | | ||
npm install | ||
npm run build | ||
working-directory: src/admin | ||
|
||
- name: Docker build | ||
run: | | ||
docker build -t ${{ env.IMAGE_NAME }} . | ||
docker tag ${{ env.IMAGE_NAME }} ${{ env.REGISTRY_IMAGE }}:latest | ||
docker tag ${{ env.IMAGE_NAME }} ${{ env.REGISTRY_IMAGE }}:${{ env.SHORT_SHA }} | ||
working-directory: src/admin | ||
|
||
- name: Push Docker image | ||
run: docker push --all-tags ${{ env.REGISTRY_IMAGE }} | ||
|
||
build-public-builder: | ||
runs-on: ubuntu-latest | ||
env: | ||
IMAGE_NAME: public-builder-${{ github.ref_name }} | ||
steps: | ||
- name: Git Checkout | ||
uses: actions/checkout@v3 | ||
|
||
- name: Set env | ||
run: | | ||
echo "SHORT_SHA=$(git rev-parse --short HEAD)" >> $GITHUB_ENV | ||
echo "REGISTRY_IMAGE=${{ secrets.OPENSHIFT_GOLD_EXTERNAL_REPOSITORY }}/${{ secrets.OPENSHIFT_GOLD_LICENSE_PLATE }}-tools/${{ env.IMAGE_NAME }}" >> $GITHUB_ENV | ||
- name: Login to OpenShift Container Repository | ||
uses: docker/login-action@v2 | ||
with: | ||
registry: ${{secrets.OPENSHIFT_GOLD_EXTERNAL_REPOSITORY}} | ||
username: ${{secrets.OPENSHIFT_GOLD_SA_USERNAME}} | ||
password: ${{secrets.OPENSHIFT_GOLD_SA_PASSWORD}} | ||
|
||
- name: Build and push builder image | ||
run: | | ||
docker build -t ${{ env.IMAGE_NAME }} -f Builder.Dockerfile . | ||
docker tag ${{ env.IMAGE_NAME }} ${{ env.REGISTRY_IMAGE }}:latest | ||
docker tag ${{ env.IMAGE_NAME }} ${{ env.REGISTRY_IMAGE }}:${{ env.SHORT_SHA }} | ||
working-directory: src/gatsby | ||
|
||
- name: Push Docker image | ||
run: docker push --all-tags ${{ env.REGISTRY_IMAGE }} | ||
|
||
- name: Trigger Gatsby static build workflow | ||
uses: peter-evans/repository-dispatch@v2 | ||
with: | ||
token: ${{ secrets.REPO_ACCESS_TOKEN }} | ||
event-type: publish-gatsby | ||
client-payload: '{"env": "dev", "branch": "${{ github.ref_name }}" }' | ||
|
||
build-maintenance: | ||
runs-on: ubuntu-latest | ||
env: | ||
IMAGE_NAME: maintenance-${{ github.ref_name }} | ||
steps: | ||
- name: Git Checkout | ||
uses: actions/checkout@v3 | ||
|
||
- name: Set env | ||
run: | | ||
echo "SHORT_SHA=$(git rev-parse --short HEAD)" >> $GITHUB_ENV | ||
echo "REGISTRY_IMAGE=${{ secrets.OPENSHIFT_GOLD_EXTERNAL_REPOSITORY }}/${{ secrets.OPENSHIFT_GOLD_LICENSE_PLATE }}-tools/${{ env.IMAGE_NAME }}" >> $GITHUB_ENV | ||
- name: Login to OpenShift Container Repository | ||
uses: docker/login-action@v2 | ||
with: | ||
registry: ${{secrets.OPENSHIFT_GOLD_EXTERNAL_REPOSITORY}} | ||
username: ${{secrets.OPENSHIFT_GOLD_SA_USERNAME}} | ||
password: ${{secrets.OPENSHIFT_GOLD_SA_PASSWORD}} | ||
|
||
- name: Docker build | ||
run: | | ||
docker build -t ${{ env.IMAGE_NAME }} . | ||
docker tag ${{ env.IMAGE_NAME }} ${{ env.REGISTRY_IMAGE }}:latest | ||
docker tag ${{ env.IMAGE_NAME }} ${{ env.REGISTRY_IMAGE }}:${{ env.SHORT_SHA }} | ||
working-directory: src/maintenance | ||
|
||
- name: Push Docker image | ||
run: docker push --all-tags ${{ env.REGISTRY_IMAGE }} | ||
|
||
build-etl: | ||
runs-on: ubuntu-latest | ||
env: | ||
IMAGE_NAME: etl-${{ github.ref_name }} | ||
BUILDER_IMAGE: registry.access.redhat.com/ubi8/nodejs-18:1-32 | ||
steps: | ||
- name: Git Checkout | ||
uses: actions/checkout@v3 | ||
|
||
- name: Set env | ||
run: echo "SHORT_SHA=$(git rev-parse --short HEAD)" >> $GITHUB_ENV | ||
|
||
- name: Login to OpenShift Container Repository | ||
uses: docker/login-action@v2 | ||
with: | ||
registry: ${{secrets.OPENSHIFT_GOLD_EXTERNAL_REPOSITORY}} | ||
username: ${{secrets.OPENSHIFT_GOLD_SA_USERNAME}} | ||
password: ${{secrets.OPENSHIFT_GOLD_SA_PASSWORD}} | ||
|
||
- name: s2i Build | ||
id: build_image | ||
uses: redhat-actions/s2i-build@v2 | ||
with: | ||
path_context: "src/etl" | ||
builder_image: ${{ env.BUILDER_IMAGE }} | ||
image: ${{ secrets.OPENSHIFT_GOLD_EXTERNAL_REPOSITORY }}/${{ secrets.OPENSHIFT_GOLD_LICENSE_PLATE }}-tools/${{ env.IMAGE_NAME }} | ||
tags: latest ${{ env.SHORT_SHA }} | ||
|
||
- name: Push Docker image | ||
run: docker push --all-tags ${{ steps.build_image.outputs.image }} | ||
build-scheduler: | ||
runs-on: ubuntu-latest | ||
env: | ||
IMAGE_NAME: scheduler-${{ github.ref_name }} | ||
BUILDER_IMAGE: registry.access.redhat.com/ubi8/nodejs-18:1-32 | ||
steps: | ||
- name: Git Checkout | ||
uses: actions/checkout@v3 | ||
|
||
- name: Set env | ||
run: echo "SHORT_SHA=$(git rev-parse --short HEAD)" >> $GITHUB_ENV | ||
|
||
- name: Login to OpenShift Container Repository | ||
uses: docker/login-action@v2 | ||
with: | ||
registry: ${{secrets.OPENSHIFT_GOLD_EXTERNAL_REPOSITORY}} | ||
username: ${{secrets.OPENSHIFT_GOLD_SA_USERNAME}} | ||
password: ${{secrets.OPENSHIFT_GOLD_SA_PASSWORD}} | ||
|
||
- name: s2i Build | ||
id: build_image | ||
uses: redhat-actions/s2i-build@v2 | ||
with: | ||
path_context: "src/scheduler" | ||
builder_image: ${{ env.BUILDER_IMAGE }} | ||
image: ${{ secrets.OPENSHIFT_GOLD_EXTERNAL_REPOSITORY }}/${{ secrets.OPENSHIFT_GOLD_LICENSE_PLATE }}-tools/${{ env.IMAGE_NAME }} | ||
tags: latest ${{ env.SHORT_SHA }} | ||
|
||
- name: Push Docker image | ||
run: docker push --all-tags ${{ steps.build_image.outputs.image }} | ||
|
||
deploy: | ||
runs-on: ubuntu-latest | ||
needs: [build-cms, build-admin] | ||
steps: | ||
- name: Git Checkout | ||
uses: actions/checkout@v3 | ||
|
||
- name: Login OpenShift | ||
uses: redhat-actions/oc-login@v1 | ||
with: | ||
openshift_server_url: ${{ secrets.OPENSHIFT_GOLD_SERVER_URL }} | ||
openshift_token: ${{ secrets.OPENSHIFT_GOLD_SERVICE_TOKEN }} | ||
|
||
- name: Trigger rollout | ||
run: | | ||
oc -n ${{ secrets.OPENSHIFT_GOLD_LICENSE_PLATE }}-dev rollout restart deployment ${{ github.ref_name }}-admin | ||
oc -n ${{ secrets.OPENSHIFT_GOLD_LICENSE_PLATE }}-dev rollout restart deployment ${{ github.ref_name }}-cms | ||
oc -n ${{ secrets.OPENSHIFT_GOLD_LICENSE_PLATE }}-dev rollout restart deployment ${{ github.ref_name }}-maintenance | ||
oc -n ${{ secrets.OPENSHIFT_GOLD_LICENSE_PLATE }}-dev rollout restart deployment ${{ github.ref_name }}-scheduler |
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
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
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
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