Backup Slack #235
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: Backup Slack | |
on: | |
schedule: | |
- cron: 0 0 * * * | |
workflow_dispatch: | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
backup: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Setup | Checkout | |
uses: actions/[email protected] | |
- name: Setup | Cache Stack | |
id: cache-stack | |
uses: actions/[email protected] | |
with: | |
path: ~/.stack | |
key: ${{ runner.os }}-stack-${{ hashFiles('**/package.yaml') }}-${{ hashFiles('**/stack.yaml.lock') }} | |
restore-keys: | | |
${{ runner.os }}-stack- | |
- name: Setup | Stack and GHC | |
uses: haskell-actions/[email protected] | |
with: | |
ghc-version: 8.10.4 # stack.yamlのresolverに合わせて更新してください | |
enable-stack: true | |
stack-version: latest | |
- name: Setup | Pull objects from R2 | |
uses: ./.github/actions/rclone | |
with: | |
config: ${{ secrets.RCLONE_CONFIG }} | |
args: "sync r2:suzuka-kosen-festa-slack-archive ./docs" | |
- name: Setup | chown to runner | |
run: sudo chown -R runner:docker ./docs | |
- name: Run | Archive Slack | |
run: stack build --exec 'slack-archive save' | |
env: | |
SLACK_API_TOKEN: ${{ secrets.SLACK_API_TOKEN }} | |
- name: Run | Upload Archive | |
uses: ./.github/actions/rclone | |
with: | |
config: ${{ secrets.RCLONE_CONFIG }} | |
args: "sync ./docs r2:suzuka-kosen-festa-slack-archive" |