Skip to content

Commit 821ee6f

Browse files
authored
Add GitHub Actions workflow for content upload
1 parent 04a3fbc commit 821ee6f

File tree

1 file changed

+58
-0
lines changed

1 file changed

+58
-0
lines changed

.github/workflows/publish.yaml

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
name: Upload Content-Plugin to Blob
2+
3+
on:
4+
push:
5+
tags:
6+
- '*'
7+
8+
env:
9+
GCP_BUCKET: ${{ vars.GCP_BUCKET }}
10+
CLOUD_PROVIDER: ${{ vars.CLOUD_PROVIDER }}
11+
AZURE_CONTAINER: ${{ vars.AZURE_CONTAINER }}
12+
13+
jobs:
14+
upload-blob:
15+
runs-on: ubuntu-latest
16+
17+
steps:
18+
- name: Checkout repository
19+
uses: actions/checkout@v4
20+
21+
22+
- name: Authenticate and Upload to Google Cloud Storage
23+
if: env.CLOUD_PROVIDER == 'gcp'
24+
run: |
25+
echo "${{ secrets.GCP_SERVICE_ACCOUNT_KEY }}" | base64 -d > /tmp/service-account-key.json
26+
gcloud auth activate-service-account --key-file=/tmp/service-account-key.json
27+
gsutil -m cp -r . gs://${{ env.GCP_BUCKET }}/content-plugins/
28+
rm -f /tmp/service-account-key.json
29+
30+
- name: Upload to Azure Blob Storage
31+
if: env.CLOUD_PROVIDER == 'azure'
32+
uses: azure/CLI@v1
33+
with:
34+
azcliversion: latest
35+
inlineScript: |
36+
az storage blob upload-batch \
37+
--account-name "${{ secrets.AZURE_STORAGE_ACCOUNT }}" \
38+
--account-key "${{ secrets.AZURE_STORAGE_KEY }}" \
39+
--destination "${{ env.AZURE_CONTAINER }}/content-plugins" \
40+
--source . \
41+
--overwrite
42+
43+
# Note: Publish to AWS S3 is not tested
44+
45+
# - name: Configure AWS credentials
46+
# if: env.CLOUD_PROVIDER == 'aws'
47+
# uses: aws-actions/configure-aws-credentials@v4
48+
# with:
49+
# aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
50+
# aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
51+
# aws-region: ${{ vars.AWS_REGION || 'us-east-1' }}
52+
53+
# - name: Upload to Amazon S3
54+
# if: env.CLOUD_PROVIDER == 'aws'
55+
# env:
56+
# S3_BUCKET: ${{ vars.S3_BUCKET }}
57+
# run: |
58+
# aws s3 sync . s3://${{ env.S3_BUCKET }}/content-plugins/

0 commit comments

Comments
 (0)