forked from bsorrentino/java2typescript
-
Notifications
You must be signed in to change notification settings - Fork 0
75 lines (66 loc) · 2.75 KB
/
Copy pathrelease.yml
File metadata and controls
75 lines (66 loc) · 2.75 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
name: Release
on:
push:
tags:
- 'v*'
permissions:
id-token: write
contents: read
defaults:
run:
shell: bash
jobs:
release:
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- name: Checkout
uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0
# Workaround for https://github.com/actions/checkout/issues/290, https://github.com/actions/checkout/issues/882
- name: Fetch annotated tags
run: git fetch --tags --force
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@7474bc4690e29a8392af63c5b98e7449536d5c3a # v4.3.1
with:
role-to-assume: ${{ vars.AWS_ROLE_PROD_JAVA2TS }}
aws-region: us-east-1
- name: Milestone or Release?
id: repository
env:
AWS_CODEARTIFACT_DOMAIN: ${{ vars.AWS_CODEARTIFACT_DOMAIN }}
AWS_CODEARTIFACT_OWNER: ${{ vars.AWS_CODEARTIFACT_OWNER }}
GITHUB_REF: ${{ github.ref }}
run: |
token=$(aws codeartifact get-authorization-token --domain "${AWS_CODEARTIFACT_DOMAIN}" --domain-owner "${AWS_CODEARTIFACT_OWNER}" --query authorizationToken --output text)
echo "::add-mask::$token"
echo "token=$token" >> $GITHUB_OUTPUT
echo "GITHUB_REF=$GITHUB_REF"
if [[ "$GITHUB_REF" =~ .*-M[0-9]+ ]]; then
echo "Milestone version detected"
echo "repositoryId=codeartifact-milestones" >> $GITHUB_OUTPUT
echo "repositoryUrl=https://${AWS_CODEARTIFACT_DOMAIN}-${AWS_CODEARTIFACT_OWNER}.d.codeartifact.us-east-1.amazonaws.com/maven/milestones" >> $GITHUB_OUTPUT
else
echo "Release version detected"
echo "repositoryId=codeartifact-releases" >> $GITHUB_OUTPUT
echo "repositoryUrl=https://${AWS_CODEARTIFACT_DOMAIN}-${AWS_CODEARTIFACT_OWNER}.d.codeartifact.us-east-1.amazonaws.com/maven/releases" >> $GITHUB_OUTPUT
fi
- name: Set up JDK 21
uses: actions/setup-java@cf277c60eb25467037889841efdb72551f06f6c3 # v4.9.1
with:
distribution: 'zulu'
java-version: '21'
server-id: ${{ steps.repository.outputs.repositoryId }}
server-username: MAVEN_USERNAME
server-password: MAVEN_PASSWORD
- name: Deploy
env:
MAVEN_USERNAME: aws
MAVEN_PASSWORD: ${{ steps.repository.outputs.token }}
REPOSITORY_ID: ${{ steps.repository.outputs.repositoryId}}
REPOSITORY_URL: ${{ steps.repository.outputs.repositoryUrl}}
run: |
mvn --batch-mode -Dstyle.color=always --no-transfer-progress \
deploy \
-Prelease \
-DrepositoryId="${REPOSITORY_ID}" \
-DrepositoryUrl="${REPOSITORY_URL}"