Correções - Release 2 #26
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
name: Metrics and Release | |
on: | |
pull_request: | |
branches: | |
- main | |
types: [closed] | |
jobs: | |
release: | |
if: github.event.pull_request.merged == true | |
runs-on: "ubuntu-latest" | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v2 | |
with: | |
fetch-depth: 0 | |
- name: Create .env file | |
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 | |
- name: Generate release and send metrics to DOC repository | |
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 "Add metrics from repository ${{ github.event.repository.name }} ${{ github.ref_name }}" | |
git push |