Skip to content

Release

Release #195

Workflow file for this run

name: Release
permissions:
id-token: write
contents: write
on:
push:
branches:
- main
paths:
- ".github/workflows/release.yml"
- "awesome/**"
schedule:
- cron: "0 9 15 * *" # every 15th of the month at 9:00 AM UTC
workflow_dispatch:
inputs:
with_analytics:
description: "Render awesome data with analytics"
required: false
default: "true"
jobs:
render-data:
name: Render Data
runs-on: ubuntu-22.04
steps:
- name: checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
token: ${{ secrets.GITHUB_TOKEN }}
- name: Setup Python 3.12
uses: actions/setup-python@v5
with:
python-version: "3.12"
cache: "pip"
- name: Setup CI
run: |
make setup-ci
- name: Render awesome data
if: github.event_name == 'push' || (github.event_name == 'workflow_dispatch' && github.event.inputs.with_analytics == 'false')
run: |
make release ARGS=--without-analytics
- name: Render awesome with analytics data
if: github.event_name == 'schedule' || (github.event_name == 'workflow_dispatch' && github.event.inputs.with_analytics == 'true')
env:
TOKEN_GITHUB_PUBLIC_API: ${{ secrets.TOKEN_GITHUB_PUBLIC_API }}
run: |
make release
- name: Render awesome README.md
id: render-awesome
run: |
git config --global user.email "${{ secrets.ACTION_EMAIL }}"
git config --global user.name "FabrizioCafolla"
if [ -z "$(git status --porcelain)" ]; then
echo "Nothing to update"
echo "commit_sha=${{ github.sha }}" >> $GITHUB_OUTPUT
else
git add awesome/**/README.md
git add analytics/*
git commit -m "release(awesome): update awesome data"
git push
echo "commit_sha=$(git rev-parse HEAD)" >> $GITHUB_OUTPUT
fi
- name: Trigger deployment workflow
uses: actions/github-script@v6
with:
github-token: ${{ secrets.ACTION_WORKFLOWS }}
retries: 3
script: |
const owner = 'italia-opensource';
const repo = 'italiaopensource.com';
const event_type = 'sync-database';
const ref = 'main';
const client_payload = {
"hash": "${{ steps.render-awesome.outputs.commit_sha }}",
"run_id": "${{ github.run_id }}",
};
github.rest.repos.createDispatchEvent({
owner,
repo,
event_type,
client_payload
});