extract-all #290
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: extract-all | |
on: | |
# Diariamente | |
#schedule: | |
#- cron: "*/15 * * * *" | |
workflow_dispatch: | |
env: | |
CANTIDAD: 5 | |
jobs: | |
extract: | |
strategy: | |
fail-fast: false | |
matrix: | |
grupo: [1, 2, 3, 4, 5, 6, 7, 8] | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Go | |
uses: actions/setup-go@v5 | |
with: | |
go-version-file: 'go.mod' | |
cache-dependency-path: "go.sum" | |
- name: build | |
run: go build | |
- name: run | |
run: | | |
chmod +x extract.sh | |
MONGO_URI="${{secrets.MONGO_URI}}" ./extract.sh ${{ matrix.grupo }} ${{ env.CANTIDAD }} | |
- name: Subir artefacto | |
uses: actions/upload-artifact@v4 | |
with: | |
name: artifact-${{ matrix.grupo }} | |
path: ./*.json | |
retention-days: 1 | |
#path: $#{{ matrix.grupo }}.json | |
electivas: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Go | |
uses: actions/setup-go@v5 | |
with: | |
go-version-file: 'go.mod' | |
cache-dependency-path: "go.sum" | |
- name: build | |
run: go build | |
- name: run | |
run: | | |
MONGO_URI="${{secrets.MONGO_URI}}" go run . electivas 40 | |
- name: Subir artefacto | |
uses: actions/upload-artifact@v4 | |
with: | |
name: artifact-9 | |
path: ./*.json | |
retention-days: 1 | |
merge-save: | |
needs: [extract, electivas] | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Go | |
uses: actions/setup-go@v5 | |
with: | |
go-version-file: 'go.mod' | |
cache-dependency-path: "go.sum" | |
- name: Descargar artefactos | |
uses: actions/download-artifact@v4 | |
with: | |
path: artifacts | |
pattern: artifact-* | |
merge-multiple: true | |
- name: Consolidar y desplegar datos | |
run: MONGO_URI="${{secrets.MONGO_URI}}" go run . deploy | |
- name: Guardar datos | |
uses: actions/upload-artifact@v4 | |
with: | |
name: data | |
path: data.json | |
retention-days: 90 | |
- name: Deploy data | |
run: | | |
git clone https://x-access-token:${{ secrets.GH_TOKEN }}@github.com/imlargo/api-asignaturas.git | |
rm -r 'api-asignaturas/data.json' | |
cp -r "data.json" "api-asignaturas/" | |
cd api-asignaturas | |
git config --global user.email "[email protected]" | |
git config --global user.name "imlargo" | |
git add . | |
git commit -m "Automated: update data materias" | |
git push |