Skip to content

Netlify - Monthly run #18

Netlify - Monthly run

Netlify - Monthly run #18

# Based on example from
# https://github.com/NiklasMerz/netlify-analytics-collector/tree/main/.github/workflows
name: Netlify - Monthly run
on:
schedule:
- cron: '1 0 1 * *'
workflow_dispatch:
jobs:
export-run:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v3
- uses: niklasmerz/[email protected]
with:
netlify-token: ${{ secrets.NETLIFY_TOKEN }}
netlify-site-id: ${{ secrets.NETLIFY_SITE }}
- name: Zip exports
run: |
zip --junk-paths monthly-summary *.csv
- name: Get current time
uses: 1466587594/get-current-time@v2
id: current-time
with:
format: MM-YYYY
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ steps.current-time.outputs.formattedTime }}
release_name: Month ${{ steps.current-time.outputs.formattedTime }}
draft: false
prerelease: false
- name: Upload Release Asset
id: upload-release-asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps
asset_path: ./monthly-summary.zip
asset_name: monthly-summary-${{ steps.current-time.outputs.formattedTime }}.zip
asset_content_type: application/zip