Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 20 additions & 6 deletions .github/workflows/build-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ jobs:
runs-on: ubuntu-latest
outputs:
version: ${{ steps.get-version.outputs.version }}
channel: ${{ steps.get-version.outputs.channel }}

steps:
- name: Checkout Repository
Expand All @@ -32,16 +33,16 @@ jobs:
- name: Setup Rust
uses: dtolnay/rust-toolchain@stable


- name: Get slicec Version
id: get-version
shell: bash
run: |
version="$(cargo metadata --no-deps --format-version 1 \
| jq -r '.packages[] | select(.name == "slicec") | .version')"

version_major_minor="${version%.*}"
echo "version=$version_major_minor" >> "$GITHUB_OUTPUT"
channel="${version%.*}"
echo "version=$version" >> "$GITHUB_OUTPUT"
echo "channel=$channel" >> "$GITHUB_OUTPUT"
Comment thread
pepone marked this conversation as resolved.

build:
needs: metadata
Expand Down Expand Up @@ -86,9 +87,20 @@ jobs:

upload:
needs: [metadata, build]
if: inputs.quality == 'nightly' && github.repository == 'icerpc/slicec'
if: github.repository == 'icerpc/slicec'
runs-on: ubuntu-latest

steps:
- name: S3 Upload Path
shell: bash
run: |
if [[ "${{ inputs.quality }}" == "stable" ]]; then
upload_path="${{ needs.metadata.outputs.channel }}"
else
upload_path="${{ inputs.quality }}/${{ needs.metadata.outputs.channel }}"
fi
echo "S3_PATH=$upload_path" >> "$GITHUB_ENV"

Comment thread
pepone marked this conversation as resolved.
- name: Download Artifacts
uses: actions/download-artifact@v8
with:
Expand All @@ -104,7 +116,7 @@ jobs:
AWS_DEFAULT_REGION: us-east-1
run: |
for file in artifacts/slicec-*.zip; do
aws s3 cp "$file" "s3://zeroc-downloads/icerpc/slicec/${{ inputs.quality }}/${{ needs.metadata.outputs.version }}/"
aws s3 cp "$file" "s3://zeroc-downloads/icerpc/slicec/${S3_PATH}/"
done

- name: Invalidate CloudFront Cache
Expand All @@ -113,4 +125,6 @@ jobs:
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_DEFAULT_REGION: us-east-1
run: |
aws cloudfront create-invalidation --distribution-id ${{ secrets.CLOUDFRONT_ZEROC_DOWNLOAD_DISTRIBUTION_ID }} --paths "/icerpc/slicec/${{ inputs.quality }}/${{ needs.metadata.outputs.version }}/*"
aws cloudfront create-invalidation \
--distribution-id ${{ secrets.CLOUDFRONT_ZEROC_DOWNLOAD_DISTRIBUTION_ID }} \
--paths "/icerpc/slicec/${S3_PATH}/*"