Delete All Releases #264
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: Delete All Releases | |
on: | |
schedule: | |
- cron: '0 19 * * *' | |
jobs: | |
delete_all_releases: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Delete all releases | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
# Delete all releases | |
releases=$(curl -s -H "Authorization: Bearer $GITHUB_TOKEN" https://api.github.com/repos/${{ github.repository }}/releases | jq -r '.[].id') | |
for release in $releases; do | |
curl --request DELETE --header "Authorization: Bearer $GITHUB_TOKEN" "https://api.github.com/repos/${{ github.repository }}/releases/$release" | |
done | |
- name: Set up Python 3.x | |
uses: actions/setup-python@v2 | |
with: | |
python-version: 3.x | |
- name: Build router configuration file | |
run: make | |
- name: Create new release | |
id: create_release | |
uses: actions/create-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag_name: v1.0.0 | |
release_name: k v1.0.0 | |
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 }} | |
asset_path: ./routes4.conf | |
asset_name: routes4.conf | |
asset_content_type: text/plain | |
- name: Upload release asset | |
id: upload_release_asset1 | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: ./routes6.conf | |
asset_name: routes6.conf | |
asset_content_type: text/plain |