@@ -51,84 +51,38 @@ jobs:
5151 GH_TOKEN : ${{ secrets.GITHUB_TOKEN }}
5252 steps :
5353 - uses : actions/checkout@v3
54- - name : Install Rust
55- run : rustup update 1.67.1 --no-self-update && rustup default 1.67.1
56- - name : Install cargo-dist
57- run : curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/v0.0.6/cargo-dist-installer.sh | sh
58- - id : create-release
59- run : |
60- cargo dist plan --tag=${{ github.ref_name }} --output-format=json > dist-manifest.json
61- echo "dist plan ran successfully"
62- cat dist-manifest.json
54+ - name : Install Rust toolchain
55+ uses : dtolnay/rust-toolchain@stable
56+ - name : Install Zig toolchain
57+ uses : korandoru/setup-zig@v1
58+ with :
59+ zig-version : 0.10.0
60+ - name : Install Cargo Lambda
61+ 62+ with :
63+ repo : cargo-lambda/cargo-lambda
64+ platform : linux # Other valid options: 'windows' or 'darwin'
65+ arch : x86_64 # Other valid options for linux: 'aarch64'
66+ - name : Build release
67+ run : cargo lambda build --release --output-format zip
6368
64- # Create the Github Release™ based on what cargo-dist thinks it should be
65- ANNOUNCEMENT_TITLE=$(jq --raw-output ".announcement_title" dist-manifest.json)
66- IS_PRERELEASE=$(jq --raw-output ".announcement_is_prerelease" dist-manifest.json)
67- jq --raw-output ".announcement_github_body" dist-manifest.json > new_dist_announcement.md
68- gh release create ${{ github.ref_name }} --draft --prerelease="$IS_PRERELEASE" --title="$ANNOUNCEMENT_TITLE" --notes-file=new_dist_announcement.md
69- echo "created announcement!"
69+ - name : release
70+ uses : actions/create-release@v1
71+ id : create_release
72+ with :
73+ draft : false
74+ prerelease : false
75+ release_name : ${{ steps.version.outputs.version }}
76+ tag_name : ${{ github.ref }}
77+ env :
78+ GITHUB_TOKEN : ${{ github.token }}
7079
71- # Upload the manifest to the Github Release™
72- gh release upload ${{ github.ref_name }} dist-manifest.json
73- echo "uploaded manifest!"
74-
75- # Disable all the upload-artifacts tasks if we have no actual releases
76- HAS_RELEASES=$(jq --raw-output ".releases != null" dist-manifest.json)
77- echo "has-releases=$HAS_RELEASES" >> "$GITHUB_OUTPUT"
78-
79- # Build and packages all the things
80- upload-artifacts :
81- # Let the initial task tell us to not run (currently very blunt)
82- needs : create-release
83- if : ${{ needs.create-release.outputs.has-releases == 'true' }}
84- strategy :
85- matrix :
86- # For these target platforms
87- include :
88- - os : macos-11
89- dist-args : --artifacts=local --target=aarch64-apple-darwin --target=x86_64-apple-darwin
90- install-dist : curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/v0.0.6/cargo-dist-installer.sh | sh
91- - os : ubuntu-20.04
92- dist-args : --artifacts=local --target=x86_64-unknown-linux-gnu
93- install-dist : curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/v0.0.6/cargo-dist-installer.sh | sh
94-
95- runs-on : ${{ matrix.os }}
96- env :
97- GH_TOKEN : ${{ secrets.GITHUB_TOKEN }}
98- steps :
99- - uses : actions/checkout@v3
100- - name : Install Rust
101- run : rustup update 1.67.1 --no-self-update && rustup default 1.67.1
102- - name : Install cargo-dist
103- run : ${{ matrix.install-dist }}
104- - name : Run cargo-dist
105- # This logic is a bit janky because it's trying to be a polyglot between
106- # powershell and bash since this will run on windows, macos, and linux!
107- # The two platforms don't agree on how to talk about env vars but they
108- # do agree on 'cat' and '$()' so we use that to marshal values between commands.
109- run : |
110- # Actually do builds and make zips and whatnot
111- cargo dist build --tag=${{ github.ref_name }} --output-format=json ${{ matrix.dist-args }} > dist-manifest.json
112- echo "dist ran successfully"
113- cat dist-manifest.json
114-
115- # Parse out what we just built and upload it to the Github Release™
116- jq --raw-output ".artifacts[]?.path | select( . != null )" dist-manifest.json > uploads.txt
117- echo "uploading..."
118- cat uploads.txt
119- gh release upload ${{ github.ref_name }} $(cat uploads.txt)
120- echo "uploaded!"
121-
122- # Mark the Github Release™ as a non-draft now that everything has succeeded!
123- publish-release :
124- # Only run after all the other tasks, but it's ok if upload-artifacts was skipped
125- needs : [create-release, upload-artifacts]
126- if : ${{ always() && needs.create-release.result == 'success' && (needs.upload-artifacts.result == 'skipped' || needs.upload-artifacts.result == 'success') }}
127- runs-on : ubuntu-latest
128- env :
129- GH_TOKEN : ${{ secrets.GITHUB_TOKEN }}
130- steps :
131- - uses : actions/checkout@v3
132- - name : mark release as non-draft
133- run : |
134- gh release edit ${{ github.ref_name }} --draft=false
80+ - name : Upload Lambda zip
81+ uses : actions/upload-release-asset@v1
82+ env :
83+ GITHUB_TOKEN : ${{ github.token }}
84+ with :
85+ upload_url : ${{ steps.create_release.outputs.upload_url }}
86+ asset_path : ./target/lambda/lambda-s3-restructure/bootstrap.zip
87+ asset_name : lambda-s3-restructure-bootstrap.zip
88+ asset_content_type : application/zip
0 commit comments