Release new version #85
Workflow file for this run
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: Release new version | |
on: | |
release: | |
types: [published] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
python-version: [3.8] | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
persist-credentials: false # use GITHUB_TOKEN | |
fetch-depth: 1 # fetch depth is nr of commits | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install pyriksdagen | |
pip install cycler | |
- name: Install jq | |
uses: dcarbone/install-jq-action@v2 | |
with: | |
version: 1.7 | |
force: false | |
- name: 'Check jq' | |
run: | | |
jq --version | |
- name: Get Current pyriksdagen version | |
run: | | |
PRD_INFO="$(curl -L https://api.github.com/repos/swerik-project/pyriksdagen/releases/latest)" | |
PRD_TAG="$(echo $PRD_INFO | jq -r .tag_name)" | |
echo "PYRIKSDAGEN_TAG=$PRD_TAG" >> $GITHUB_ENV | |
- name: Get Current scripts version | |
run: | | |
SCRIPTS_INFO="$(curl -L https://api.github.com/repos/swerik-project/scripts/releases/latest)" | |
SCRIPTS_TAG="$(echo $SCRIPTS_INFO | jq -r .tag_name)" | |
echo "SCRIPTS_TAG=$SCRIPTS_TAG" >> $GITHUB_ENV | |
- name: Get Current rcr version | |
run: | | |
RCR_INFO="$(curl -L https://api.github.com/repos/swerik-project/rcr/releases/latest)" | |
RCR_TAG="$(echo $RCR_INFO | jq -r .tag_name)" | |
echo "RCR_TAG=$RCR_TAG" >> $GITHUB_ENV | |
- name: Get Persons repo version nr, dl zip for release | |
run: | | |
PERSONS_INFO="$(curl -L https://api.github.com/repos/swerik-project/riksdagen-persons/releases/latest)" | |
PERSONS_TAG="$(echo $PERSONS_INFO | jq -r .tag_name)" | |
echo "PERSONS_TAG=$PERSONS_TAG">> $GITHUB_ENV | |
curl -LO https://api.github.com/repos/swerik-project/riksdagen-persons/releases/download/$PERSONS_TAG/persons.zip | |
mv persons.zip "persons_$PERSONS_TAG.zip" | |
- name: Upload metadata to release | |
uses: svenstaro/upload-release-action@v2 | |
with: | |
repo_token: ${{ secrets.GITHUB_TOKEN }} | |
file: persons_${{ env.PERSONS_TAG }}.zip | |
tag: ${{ github.ref }} | |
- name: Download records data, get repo version nr, and unzip | |
run: | | |
RECORDS_INFO="$(curl -L https://api.github.com/repos/swerik-project/riksdagen-records/releases/latest)" | |
RECORDS_TAG="$(echo $RECORDS_INFO | jq -r .tag_name)" | |
echo "RECORDS_TAG=$RECORDS_TAG" >> $GITHUB_ENV | |
curl -LO https://api.github.com/repos/swerik-project/riksdagen-records/releases/download/$RECORDS_TAG/records.zip | |
mv records.zip "records_$RECORDS_TAG.zip" | |
- name: Upload records to release | |
uses: svenstaro/upload-release-action@v2 | |
with: | |
repo_token: ${{ secrets.GITHUB_TOKEN }} | |
file: records_${{ env.RECORDS_TAG }}.zip | |
tag: ${{ github.ref }} | |
# Motions | |
- name: Download Motions data and get repo version nr | |
run: | | |
MOTIONS_INFO="$(curl -L https://api.github.com/repos/swerik-project/riksdagen-motions/releases/latest)" | |
MOTIONS_TAG="$(echo $MOTIONS_INFO | jq -r .tag_name)" | |
echo "MOTIONS_TAG=$MOTIONS_TAG" >> $GITHUB_ENV | |
# curl -LO https://api.github.com/repos/swerik-project/riksdagen-motions/releases/download/$MOTIONS_TAG/motions.zip | |
# mv motions.zip "motions_$MOTIONS_TAG.zip" | |
# | |
#- name: Upload motions to release | |
# uses: svenstaro/upload-release-action@v2 | |
# with: | |
# repo_token: ${{ secrets.GITHUB_TOKEN }} | |
# file: motions_${{ env.MOTIONS_TAG }}.zip | |
# tag: ${{ github.ref }} | |
# | |
# UNCOMMENT BEFORE NEXT RELEASE | |
# | |
- name: Download interpellations, get repo version nr, and unzip | |
run: | | |
INTERPELLATIONS_INFO="$(curl -L https://api.github.com/repos/swerik-project/riksdagen-interpellations/releases/latest)" | |
INTERPELLATIONS_TAG="$(echo $INTERPELLATIONS_INFO | jq -r .tag_name)" | |
echo "INTERPELLATIONS_TAG=$INTERPELLATIONS_TAG" >> $GITHUB_ENV | |
curl -LO https://api.github.com/repos/swerik-project/riksdagen-interpellations/releases/download/$INTERPELLATIONS_TAG/interpellation-questions.zip | |
mv interpellation-questions.zip "interpellation-questions_$RECORDS_TAG.zip" | |
- name: Upload records to release | |
uses: svenstaro/upload-release-action@v2 | |
with: | |
repo_token: ${{ secrets.GITHUB_TOKEN }} | |
file: interpellation-questions_${{ env.INTERPELLATIONS_TAG }}.zip | |
tag: ${{ github.ref }} | |
- name: Generate README | |
run: | | |
PYTHONPATH="$PYTHONPATH:." python readme/src/generate-markdown.py -v ${{ github.ref_name }} -pv ${{ env.PERSONS_TAG }} -rv ${{ env.RECORDS_TAG }} -py ${{ env.PYRIKSDAGEN_TAG }} -mv ${{ env.MOTIONS_TAG }} -iv ${{ env.INTERPELLATION_TAG }} -sv ${{ env.SCRIPTS_TAG }} -r ${{ env.RCR_TAG }} | |
- name: Add and Commit generated file | |
run: | | |
git status | |
git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com" | |
git config --local user.name "github-actions[bot]" | |
git add version-compatibility/ | |
git add README.md | |
git commit -m "chore: update version compatibility and readme" | |
git status | |
- name: Push changes | |
uses: ad-m/github-push-action@master | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
branch: main |