-
Notifications
You must be signed in to change notification settings - Fork 1
70 lines (65 loc) · 2.33 KB
/
mirror.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
# This is a basic workflow that is manually triggered
name: Mirror workflow
# Controls when the action will run. Workflow runs when manually triggered using the UI
# or API.
on:
workflow_dispatch:
inputs:
suffix:
description: "Suffix to be added to tag"
required: false
schedule:
- cron: "42 6 * * *"
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
mirror:
# The type of runner that the job will run on
runs-on: ubuntu-latest
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Runs a single command using the runners shell
- name: Set environment vars
run: |
echo "PULLDATE=$(date +%F)" >> $GITHUB_ENV
echo "FULLTIME=$(date)" >> $GITHUB_ENV
test -z ${{ github.event.inputs.suffix }} && echo "TAGNAME=$(date +%F)" >> $GITHUB_ENV
test -z ${{ github.event.inputs.suffix }} || echo "TAGNAME=$(date +%F)${{ github.event.inputs.suffix }}" >> $GITHUB_ENV
echo "$GITHUB_ENV"
test -f $GITHUB_ENV && cat $GITHUB_ENV
- name: Check out repository code
uses: actions/checkout@v2
with:
path: bin
- name: Checkout last mirror
uses: actions/checkout@v2
with:
ref: releases
path: mirror
- name: Mirror archive data
run: |
cp bin/mirror.repec.sh mirror/
cp bin/README.md mirror/
chmod +x mirror/mirror.repec.sh
cd mirror/
./mirror.repec.sh
# Capture all the PKG files
- name: Capture PKG files
run: |
zip -rp stata-pkg-files.zip $(find mirror/fmwww.bc.edu/repec/bocode -iname \*.pkg)
# Upload as artifact
- name: Upload artifact of PKG files
uses: actions/upload-artifact@v4
with:
name: stata-pkg-files
path: stata-pkg-files.zip
# Deploy to a new branch
- name: Deploy
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: mirror
publish_branch: releases
keep_files: true
full_commit_message: "Snapshot of SSC Archive as of ${{ env.FULLTIME }}"
tag_name: ${{ env.PULLDATE }}${{ github.event.inputs.suffix }}
tag_message: "Snapshot of SSC Archive as of ${{ env.FULLTIME }}${{ github.event.inputs.tags }}"