-
Notifications
You must be signed in to change notification settings - Fork 3
69 lines (60 loc) · 2.36 KB
/
pre-release.yaml
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
# Workflow to fetch the latest commit hash on the main branch and upload artifacts to CF storage.
name: Build and upload pre-release
on:
push:
branches:
- main
workflow_dispatch:
concurrency: ${{ github.workflow }}-${{ github.ref }}
jobs:
stellar-contract-names:
name: Get all Stellar contracts
runs-on: blacksmith-2vcpu-ubuntu-2204
outputs:
releases: ${{ steps.prepare-release.outputs.releases }}
commit_hash: ${{ steps.get-commit-hash.outputs.hash }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Install dependencies
run: sudo apt-get install -y jq
- name: Get latest commit hash
id: get-commit-hash
run: echo "hash=$(git rev-parse --short HEAD)" >> "$GITHUB_OUTPUT"
- name: Prepare JSON output for release
id: prepare-release
run: |
RELEASES_JSON=$(find contracts -maxdepth 1 -mindepth 1 -type d | sed 's|contracts/||' | jq -R . | jq -s --arg commit "${{ steps.get-commit-hash.outputs.hash }}" 'map({
package_name: .,
version: $commit,
package_git_tag: "\(.)_\($commit)"
})')
echo "releases=$(echo "$RELEASES_JSON" | jq -c)" >> "$GITHUB_OUTPUT"
build:
needs: stellar-contract-names
uses: ./.github/workflows/reusable-build.yaml
with:
commit-hash: ${{ needs.stellar-contract-names.outputs.commit_hash }}
upload:
needs: [stellar-contract-names, build]
strategy:
matrix:
releases: ${{ fromJson(needs.stellar-contract-names.outputs.releases) }}
uses: ./.github/workflows/reusable-upload.yaml
permissions:
id-token: write
contents: read
with:
package-name: ${{ matrix.releases.package_name }}
package-version: ${{ matrix.releases.version }}
package-git-tag: ${{ matrix.releases.package_git_tag }}
artifact-name: ${{ needs.build.outputs.artifact-name }}
artifact-path: ${{ needs.build.outputs.artifact-path }}
cf-bucket-name: ${{ vars.CF_BUCKET_NAME }}
cf-config-bucket-root-key: ${{ vars.CF_BUCKET_ROOT_KEY }}
github-release: false
secrets:
github-token: ${{ secrets.PAT_TOKEN }}
cf-endpoint-url: ${{ secrets.CF_ENDPOINT_URL }}
cf-bucket-access-key-id: ${{ secrets.CF_BUCKET_ACCESS_KEY_ID }}
cf-bucket-secret-access-key: ${{ secrets.CF_BUCKET_SECRET_ACCESS_KEY }}