Skip to content

Commit 5b1714b

Browse files
authored
[REL-4161] Cblackburn/rel 4161/fix release action config (#524)
Copying artifacts a temporary directory so they can be picked up by `ncipollo/release-action`. This is the last piece that was missing, I think. Also a bit of minor cleanup here as this should be just about finished now. <!-- ld-jira-link --> --- Related Jira issue: [REL-4161: Migrate ld-find-code-refs from Releaser to GHA](https://launchdarkly.atlassian.net/browse/REL-4161) <!-- end-ld-jira-link -->
1 parent 9869760 commit 5b1714b

File tree

4 files changed

+27
-15
lines changed

4 files changed

+27
-15
lines changed

.github/workflows/release.yml

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ jobs:
2020
release:
2121
permissions:
2222
id-token: 'write'
23+
contents: 'write'
2324
runs-on: ubuntu-latest
2425
env:
2526
LD_RELEASE_VERSION: ${{ inputs.releaseVersion }}
@@ -31,8 +32,8 @@ jobs:
3132
- uses: actions/checkout@v4
3233
with:
3334
fetch-depth: 0
34-
- uses: launchdarkly/gh-actions/actions/release-secrets@release-secrets-v1.2.0
35-
name: Get secrets
35+
- name: get secrets
36+
uses: launchdarkly/gh-actions/actions/release-secrets@release-secrets-v1.2.0
3637
with:
3738
aws_assume_role: ${{ vars.AWS_ROLE_ARN }}
3839
ssm_parameter_pairs: '/global/services/docker/public/username = DOCKER_USERNAME, /global/services/docker/public/token = DOCKER_TOKEN, /production/common/releasing/circleci/orb-token= CIRCLECI_CLI_TOKEN, /production/common/releasing/bitbucket/username = BITBUCKET_USERNAME, /production/common/releasing/bitbucket/token = BITBUCKET_TOKEN'
@@ -60,13 +61,14 @@ jobs:
6061
else
6162
./scripts/release/publish.sh
6263
fi
63-
- name: Commit changes and tag
64-
run: |
65-
./scripts/release/commit-and-tag.sh
66-
- name: Create Github release
64+
ls -1a "$ARTIFACT_DIRECTORY"
65+
- name: commit changes and tag
66+
run: ./scripts/release/commit-and-tag.sh
67+
- name: create Github release
6768
uses: ncipollo/release-action@v1.14.0
68-
if: ${{ inputs.dryRun != 'true' }}
69+
if: ${{ !inputs.dryRun }}
6970
with:
7071
token: ${{ secrets.GITHUB_TOKEN }}
7172
tag: v${{ inputs.releaseVersion }}
7273
body: ${{ inputs.changeLog }}
74+
artifacts: ${{ env.ARTIFACT_DIRECTORY }}/*

scripts/release/publish-dry-run.sh

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,8 @@
22

33
set -euo pipefail
44

5-
echo ${DOCKER_TOKEN} | sudo docker login --username ${DOCKER_USERNAME} --password-stdin
6-
7-
sudo PATH=${PATH} GITHUB_TOKEN=${GITHUB_TOKEN} make products-for-release
8-
9-
mkdir -p ${ARTIFACT_DIRECTORY}
5+
source $(dirname $0)/stage-artifacts.sh
6+
stage_artifacts products-for-release
107

118
# Copy the Docker image that goreleaser just built into the artifacts - we only do
129
# this in a dry run, because in a real release the image will be available from

scripts/release/publish.sh

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,8 @@
22

33
set -euo pipefail
44

5-
echo ${DOCKER_TOKEN} | sudo docker login --username ${DOCKER_USERNAME} --password-stdin
6-
7-
sudo PATH=${PATH} GITHUB_TOKEN=${GITHUB_TOKEN} make publish
5+
source $(dirname $0)/stage-artifacts.sh
6+
stage_artifacts publish
87

98
# make bitbucket and github known hosts to push successfully
109
mkdir -m700 ~/.ssh

scripts/release/stage-artifacts.sh

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#!/bin/bash
2+
3+
set -euo pipefail
4+
5+
stage_artifacts() {
6+
TARGET=$1
7+
8+
echo "$DOCKER_TOKEN" | sudo docker login --username "$DOCKER_USERNAME" --password-stdin
9+
10+
sudo PATH="$PATH" GITHUB_TOKEN="$GITHUB_TOKEN" make "$TARGET"
11+
12+
mkdir -p "$ARTIFACT_DIRECTORY"
13+
cp ./dist/*.deb ./dist/*.rpm ./dist/*.tar.gz ./dist/*.txt "$ARTIFACT_DIRECTORY"
14+
}

0 commit comments

Comments
 (0)