-
Notifications
You must be signed in to change notification settings - Fork 37
58 lines (50 loc) · 2.11 KB
/
Release to server.yml
File metadata and controls
58 lines (50 loc) · 2.11 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
name: Release to Server
on:
release:
types: [published]
jobs:
deploy-installer:
runs-on: ubuntu-latest
permissions:
id-token: write
contents: read
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v4
with:
role-to-assume: ${{ secrets.AWS_IAM_ROLE_TO_ASSUME }}
aws-region: ${{ secrets.AWS_REGION }}
- name: Get release version and installer name
id: get_version
run: |
VERSION=$(echo "${{ github.event.release.tag_name }}" | sed 's/^v//')
echo "version=$VERSION" >> $GITHUB_OUTPUT
echo "local_installer_name=Game.Save.Manager.Setup.$VERSION.exe" >> $GITHUB_OUTPUT
echo "server_installer_name=Game Save Manager Setup $VERSION.exe" >> $GITHUB_OUTPUT
- name: Download release asset
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh release download ${{ github.event.release.tag_name }} --pattern "${{ steps.get_version.outputs.local_installer_name }}"
- name: Delete previous stable installers from S3
env:
S3_BUCKET_NAME: ${{ secrets.S3_BUCKET_NAME }}
S3_GSM_PREFIX: "GSM"
run: |
aws s3 rm "s3://${S3_BUCKET_NAME}/${S3_GSM_PREFIX}/" \
--recursive \
--exclude "*" \
--include "Game Save Manager Setup*.exe" \
--exclude "*beta*"
echo "Previous stable installers deleted from s3://${S3_BUCKET_NAME}/${S3_GSM_PREFIX}/"
- name: Upload new installer to AWS S3
env:
S3_BUCKET_NAME: ${{ secrets.S3_BUCKET_NAME }}
S3_GSM_PREFIX: "GSM"
run: |
LOCAL_INSTALLER_NAME="${{ steps.get_version.outputs.local_installer_name }}"
SERVER_INSTALLER_NAME="${{ steps.get_version.outputs.server_installer_name }}"
aws s3 cp "./${LOCAL_INSTALLER_NAME}" "s3://${S3_BUCKET_NAME}/${S3_GSM_PREFIX}/${SERVER_INSTALLER_NAME}"
echo "'${LOCAL_INSTALLER_NAME}' uploaded to s3://${S3_BUCKET_NAME}/${S3_GSM_PREFIX}/"