Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

release: update release.yml to use env variables instead of context v… #358

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
19 changes: 12 additions & 7 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ jobs:
has-releases: ${{ steps.create-release.outputs.has-releases }}
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_REF_NAME: ${{ github.ref_name }}
steps:
- uses: actions/checkout@v3
with:
Expand All @@ -71,19 +72,19 @@ jobs:
- id: create-release
run: |
export PATH=$CARGO_HOME/bin:$PATH
cargo dist plan --tag=${{ github.ref_name }} --output-format=json > dist-manifest.json
cargo dist plan --tag="${GITHUB_REF_NAME}" --output-format=json > dist-manifest.json
echo "dist plan ran successfully"
cat dist-manifest.json

# Create the Github Release™ based on what cargo-dist thinks it should be
ANNOUNCEMENT_TITLE=$(jq --raw-output ".announcement_title" dist-manifest.json)
IS_PRERELEASE=$(jq --raw-output ".announcement_is_prerelease" dist-manifest.json)
jq --raw-output ".announcement_github_body" dist-manifest.json > new_dist_announcement.md
gh release create ${{ github.ref_name }} --draft --prerelease="$IS_PRERELEASE" --title="$ANNOUNCEMENT_TITLE" --notes-file=new_dist_announcement.md
gh release create "${GITHUB_REF_NAME}" --draft --prerelease="$IS_PRERELEASE" --title="$ANNOUNCEMENT_TITLE" --notes-file=new_dist_announcement.md
echo "created announcement!"

# Upload the manifest to the Github Release™
gh release upload ${{ github.ref_name }} dist-manifest.json
gh release upload "${GITHUB_REF_NAME}" dist-manifest.json
echo "uploaded manifest!"

# Disable all the upload-artifacts tasks if we have no actual releases
Expand Down Expand Up @@ -115,12 +116,15 @@ jobs:
labels: bottlerocket_ubuntu-latest_16-core
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
MATRIX_DIST_ARGS: ${{ matrix.dist-args }}
MATRIX_INSTALL_DIST: ${{ matrix.install-dist }}
GITHUB_REF_NAME: ${{ github.ref_name }
steps:
- uses: actions/checkout@v3
with:
submodules: recursive
- name: Install cargo-dist
run: ${{ matrix.install-dist }}
run: "${MATRIX_INSTALL_DIST}"
- name: Install Cross
# Pin cargo cross to a version that we know is working for us.
run: |
Expand All @@ -133,15 +137,15 @@ jobs:
run: |
export PATH=$CARGO_HOME/bin:$PATH
# Actually do builds and make zips and whatnot
cargo dist build --tag=${{ github.ref_name }} --output-format=json ${{ matrix.dist-args }} > dist-manifest.json
cargo dist build --tag="${GITHUB_REF_NAME}" --output-format=json ${MATRIX_DIST_ARGS} > dist-manifest.json
echo "dist ran successfully"
cat dist-manifest.json

# Parse out what we just built and upload it to the Github Release™
jq --raw-output ".artifacts[]?.path | select( . != null )" dist-manifest.json > uploads.txt
echo "uploading..."
cat uploads.txt
gh release upload ${{ github.ref_name }} $(cat uploads.txt)
gh release upload "${GITHUB_REF_NAME}" $(cat uploads.txt)
echo "uploaded!"

# Mark the Github Release™ as a non-draft now that everything has succeeded!
Expand All @@ -152,10 +156,11 @@ jobs:
runs-on: ubuntu-latest
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_REF_NAME: ${{ github.ref_name }}
steps:
- uses: actions/checkout@v3
with:
submodules: recursive
- name: mark release as non-draft
run: |
gh release edit ${{ github.ref_name }} --draft=false
gh release edit "${GITHUB_REF_NAME}" --draft=false
Loading