Repository navigation
133 lines (119 loc) · 5.23 KB
/
Copy pathpublish.yml
File metadata and controls
133 lines (119 loc) · 5.23 KB
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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
name: hdfview publish to S3
# Triggers the workflow on demand
on:
workflow_dispatch:
inputs:
release_version_tag:
description: 'HDFView Release version tag (required for publishing release artifacts)'
type: string
required: false
target_dir:
description: 'HDFView target bucket directory'
type: string
required: true
local_dir:
description: 'Local directory in HDFVIEW/ to publish (for branch files)'
type: string
required: false
publish_source:
description: 'Publish source tarballs from release'
type: boolean
default: true
publish_binaries:
description: 'Publish binary packages from release'
type: boolean
default: true
publish_apps:
description: 'Publish app packages from release'
type: boolean
default: true
publish_docs:
description: 'Publish documentation from release'
type: boolean
default: true
publish_branch_files:
description: 'Publish files from branch HDFVIEW directory'
type: boolean
default: false
permissions:
contents: read
jobs:
publish:
runs-on: ubuntu-latest
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- name: Get Sources
uses: actions/checkout@9a9194f87191a7e9055e3e9b95b8cfb13023bb08 # v4.1.7
with:
fetch-depth: 0
ref: '${{ github.head_ref || github.ref_name }}'
# Fetch release artifacts conditionally based on file type
- name: Get source tarballs from release
if: ${{ inputs.release_version_tag != '' && inputs.publish_source }}
uses: dsaltares/fetch-gh-release-asset@master
with:
repo: 'HDFGroup/hdfview'
version: 'tags/${{ inputs.release_version_tag }}'
regex: true
target: 'HDFVIEW/'
file: '^HDFView-[0-9]+\.[0-9]+\.[0-9]+\.(tar\.gz|zip)$'
- name: Get checksums from release
if: ${{ inputs.release_version_tag != '' && (inputs.publish_source || inputs.publish_binaries || inputs.publish_apps) }}
uses: dsaltares/fetch-gh-release-asset@master
with:
repo: 'HDFGroup/hdfview'
version: 'tags/${{ inputs.release_version_tag }}'
regex: true
target: 'HDFVIEW/'
file: '\.sha256sums\.txt$'
- name: Get binary packages from release
if: ${{ inputs.release_version_tag != '' && inputs.publish_binaries }}
uses: dsaltares/fetch-gh-release-asset@master
with:
repo: 'HDFGroup/hdfview'
version: 'tags/${{ inputs.release_version_tag }}'
regex: true
target: 'HDFVIEW/'
file: '^HDFView-[0-9]+\.[0-9]+\.[0-9]+-(Linux-x86_64\.tar\.gz|win64\.zip|Darwin\.tar\.gz)$'
- name: Get app packages from release
if: ${{ inputs.release_version_tag != '' && inputs.publish_apps }}
uses: dsaltares/fetch-gh-release-asset@master
with:
repo: 'HDFGroup/hdfview'
version: 'tags/${{ inputs.release_version_tag }}'
regex: true
target: 'HDFVIEW/'
file: '^HDFView-[0-9]+\.[0-9]+\.[0-9]+App-(Linux-x86_64\.tar\.gz|win64\.zip|Darwin\.tar\.gz)$'
- name: Get UsersGuide from release
if: ${{ inputs.release_version_tag != '' && inputs.publish_docs }}
uses: dsaltares/fetch-gh-release-asset@master
with:
repo: 'HDFGroup/hdfview'
version: 'tags/${{ inputs.release_version_tag }}'
regex: true
target: 'HDFVIEW/'
file: '^UsersGuide\.(tar\.gz|zip)$'
- name: Setup AWS CLI
uses: aws-actions/configure-aws-credentials@v4
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: ${{ secrets.AWS_REGION }}
# Sync release artifacts to downloads directory
- name: Sync release files to S3 downloads
if: ${{ inputs.release_version_tag != '' && (inputs.publish_source || inputs.publish_binaries || inputs.publish_apps || inputs.publish_docs) }}
run: |
aws s3 sync ./HDFVIEW s3://${{ secrets.AWS_S3_BUCKET }}/${{ vars.TARGET_PATH }}/${{ inputs.target_dir }}/downloads --delete
# Extract and sync documentation
- name: Uncompress UsersGuide
if: ${{ inputs.release_version_tag != '' && inputs.publish_docs }}
run: tar -zxvf ${{ github.workspace }}/HDFVIEW/UsersGuide.tar.gz
- name: Sync UsersGuide to S3
if: ${{ inputs.release_version_tag != '' && inputs.publish_docs }}
run: |
aws s3 sync ./UsersGuide s3://${{ secrets.AWS_S3_BUCKET }}/${{ vars.TARGET_PATH }}/${{ inputs.target_dir }}/documentation/UsersGuide --delete
# Sync branch files
- name: Sync branch files to S3
if: ${{ inputs.publish_branch_files && inputs.local_dir != '' }}
run: |
aws s3 sync ./HDFVIEW/${{ inputs.local_dir }} s3://${{ secrets.AWS_S3_BUCKET }}/${{ vars.TARGET_PATH }}/${{ inputs.target_dir }}