Merge pull request #5 from CIAT-DAPA/develop #5
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 workflow will install Python dependencies, run tests and lint with a single version of Python | |
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python | |
name: Devops FORAGE_ETL | |
on: | |
push: | |
branches: ["stage"] | |
tags: | |
- "v*" | |
permissions: | |
contents: read | |
jobs: | |
# ------- START ORM PROCCESS -------- # | |
TestETL: | |
runs-on: ubuntu-latest | |
defaults: | |
run: | |
shell: bash -el {0} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Conda | |
uses: conda-incubator/setup-miniconda@v3 | |
with: | |
activate-environment: Biomass_Pipeline | |
environment-file: ./src/environment.yml | |
python-version: 3.12 | |
auto-activate-base: false | |
- name: Run Tests | |
run: | | |
python -m unittest discover -s ./src/tests/ -p 'test_*.py' | |
# ------- END ORM PROCCESS -------- # | |
# ------- START MERGE PROCCESS -------- # | |
MergeMainETL: | |
needs: TestETL | |
name: Merge Stage with Main | |
permissions: write-all | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@master | |
- name: Merge stage -> 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: MergeMainETL | |
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 | |
# API Zip | |
- name: Zip artifact for deployment | |
run: zip releaseForageEtl.zip ./src/* -r | |
# Upload Artifacts | |
- name: Upload Api artifact for deployment job | |
uses: actions/upload-artifact@v3 | |
with: | |
name: ForageEtl | |
path: releaseForageEtl.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 API | |
id: upload-api-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: ./releaseForageEtl.zip | |
asset_name: releaseForageEtl.zip | |
asset_content_type: application/zip | |
# ------- END RELEASE PROCCESS -------- # |