Skip to content

Merge pull request #75 from CIAT-DAPA/develop #70

Merge pull request #75 from CIAT-DAPA/develop

Merge pull request #75 from CIAT-DAPA/develop #70

Workflow file for this run

name: Devops WpFronEnd
on:
push:
branches: [ "stage" ]
tags:
- 'v*'
permissions:
contents: read
env:
REACT_APP_PRODUCTION_API_URL: ${{secrets.REACT_APP_PRODUCTION_API_URL}}
REACT_APP_DEBUG: "false"
REACT_APP_KEY_GRAPHHOPER: ${{secrets.REACT_APP_KEY_GRAPHHOPER}}
REACT_APP_KEYCLOAK_URL_PRODUCTION: ${{secrets.REACT_APP_KEYCLOAK_URL_PRODUCTION}}
jobs:
# ------- START FRONT PROCCESS -------- #
InstallPackage:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 18
- name: Install packages
run: |
cd ./src
echo "REACT_APP_PRODUCTION_API_URL=${{env.REACT_APP_PRODUCTION_API_URL}}" > .env
echo "REACT_APP_DEBUG=${{env.REACT_APP_DEBUG}}" >> .env
echo "REACT_APP_KEY_GRAPHHOPER=${{env.REACT_APP_KEY_GRAPHHOPER}}" >> .env
echo "REACT_APP_KEYCLOAK_URL_PRODUCTION=${{env.REACT_APP_KEYCLOAK_URL_PRODUCTION}}" >> .env
npm install
# ------- END FRONT PROCCESS -------- #
# ------- START MERGE PROCCESS -------- #
MergeMainFront:
needs: [InstallPackage]
name: Merge Pre deploy with Main
permissions: write-all
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@main
- name: Merge pre_deploy -> main
uses: devmasx/merge-branch@master
with:
type: now
head_to_merge: ${{ github.ref }}
target_branch: main
github_token: ${{ github.token }}
# ------- END MERGE PROCCESS -------- #
# ------- START RELEASE PROCCESS -------- #
PostRelease:
needs: MergeMainFront
name: Create Release
runs-on: ubuntu-latest
permissions: write-all
steps:
- uses: actions/checkout@v3
with:
fetch-depth: '0'
- uses: actions/setup-node@v3
with:
node-version: 18
# Front Zip
- name: Install packages
run: |
cd ./src
echo "REACT_APP_PRODUCTION_API_URL=${{env.REACT_APP_PRODUCTION_API_URL}}" > .env
echo "REACT_APP_DEBUG=${{env.REACT_APP_DEBUG}}" >> .env
echo "REACT_APP_KEY_GRAPHHOPER=${{env.REACT_APP_KEY_GRAPHHOPER}}" >> .env
echo "REACT_APP_KEYCLOAK_URL_PRODUCTION=${{env.REACT_APP_KEYCLOAK_URL_PRODUCTION}}" >> .env
npm install
npm run build
- name: Zip artifact front for deployment
run: |
cd ./src/build
ls
zip releaseFront.zip ./* -r
# Upload Artifacts
- name: Upload Front artifact for deployment job
uses: actions/upload-artifact@v3
with:
name: Frontend
path: releaseFront.zip
# Generate Tagname
- name: Generate Tagname for release
id: taggerDryRun
uses: anothrNick/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
WITH_V: true
DRY_RUN: true
DEFAULT_BUMP: patch
RELEASE_BRANCHES : stage,main
BRANCH_HISTORY: last
# Create release
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ github.token }}
with:
tag_name: ${{ steps.taggerDryRun.outputs.new_tag }}
release_name: Release ${{ steps.taggerDryRun.outputs.new_tag }}
#body_path: ./body.md
body: ${{ github.event.head_commit.message }}
draft: false
prerelease: false
# Upload Assets to release
- name: Upload Release Asset Front
id: upload-front-release-asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps
asset_path: ./src/build/releaseFront.zip
asset_name: releaseFront.zip
asset_content_type: application/zip
# ------- END RELEASE PROCCESS -------- #