From ffff21b680c18cae3375c15ac91bca23e17bd7ac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Victor=20Le=C3=A3o?= Date: Sun, 21 Jul 2024 20:34:02 -0300 Subject: [PATCH] Update release.yml --- .github/workflows/release.yml | 59 ++++++++++++++++++++--------------- 1 file changed, 34 insertions(+), 25 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index cd1250b..3410857 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,4 +1,4 @@ -name: Release +name: Export de métricas on: pull_request: @@ -6,35 +6,44 @@ on: - main - develop types: [ closed ] - + jobs: release: if: github.event.pull_request.merged == true && contains(github.event.pull_request.labels.*.name, 'NOT RELEASE') == false runs-on: "ubuntu-latest" - + environment: actions + steps: - - uses: actions/checkout@v2 - with: + - uses: actions/checkout@v3 + with: fetch-depth: 0 + + - name: Install dotenv + run: pip install python-dotenv packaging + + - name: Cria arquivo .env + run: | + touch ./sonar_scripts/.env + echo GITHUB_TOKEN=${{ secrets.API_TOKEN_GITHUB }} >> ./sonar_scripts/.env + echo RELEASE_MAJOR=${{ contains(github.event.pull_request.labels.*.name, 'MAJOR RELEASE') }} >> ./sonar_scripts/.env + echo RELEASE_MINOR=${{ contains(github.event.pull_request.labels.*.name, 'MINOR RELEASE') }} >> ./sonar_scripts/.env + echo RELEASE_FIX=${{ contains(github.event.pull_request.labels.*.name, 'FIX RELEASE') }} >> ./sonar_scripts/.env + echo DEVELOP=${{ contains(github.event.pull_request.labels.*.name, 'DEVELOP') }} >> ./sonar_scripts/.env + + - name: Criar diretório + run: mkdir analytics-raw-data - - name: Cria arquivo .env - run: | - touch ./scripts/.env - echo TOKEN=${{ secrets.API_TOKEN_GITHUB }} >> ./scripts/.env - echo RELEASE_MAJOR=${{ contains(github.event.pull_request.labels.*.name, 'MAJOR RELEASE') }} >> ./scripts/.env - echo RELEASE_MINOR=${{ contains(github.event.pull_request.labels.*.name, 'MINOR RELEASE') }} >> ./scripts/.env - echo RELEASE_FIX=${{ contains(github.event.pull_request.labels.*.name, 'FIX RELEASE') }} >> ./scripts/.env - echo DEVELOP=${{ contains(github.event.pull_request.labels.*.name, 'DEVELOP') }} >> ./scripts/.env + - name: Coletar métricas no SonarCloud + run: python ./sonar_scripts/parser.py - - name: Gera release e envia métricas para repositório de DOC - run: | - cd scripts && yarn install && node release.js - git config --global user.email "${{secrets.GIT_USER_EMAIL}}" - git config --global user.name "${{secrets.GIT_USER_NAME}}" - git clone --single-branch --branch main "https://x-access-token:${{secrets.API_TOKEN_GITHUB}}@github.com/fga-eps-mds/${{secrets.GIT_DOC_REPO}}" ${{secrets.GIT_DOC_REPO}} - mkdir -p ${{secrets.GIT_DOC_REPO}}/analytics-raw-data - cp -R analytics-raw-data/*.json ${{secrets.GIT_DOC_REPO}}/analytics-raw-data - cd ${{secrets.GIT_DOC_REPO}} - git add . - git commit -m "Adicionando métricas do repositório ${{ github.event.repository.name }} ${{ github.ref_name }}" - git push \ No newline at end of file + - name: Envia métricas para repo de Doc + run: | + git config --global user.email "${{secrets.USER_EMAIL}}" + git config --global user.name "${{secrets.USER_NAME}}" + git clone --single-branch --branch main "https://x-access-token:${{secrets.API_TOKEN_GITHUB}}@github.com/fga-eps-mds/2024.1-UnB-TV-DOC" doc + mkdir -p doc/analytics-raw-data + cp -R analytics-raw-data/*.json doc/analytics-raw-data + cd doc + git add . + git commit -m "Adicionando métricas do repositório ${{ github.event.repository.name }} ${{ github.ref_name }}" + git push