I'm trying to write a workflow to have my GitHub project release populated by the tag creation workflow.
I already know how to create the release (using actions/create-release@v1.0.0
) and how to push an artifact in the release (using actions/upload-release-asset
).
But, since I'm building Rust code, I ahve to compile it on different platforms. Obviously, for that, I have one job per platform and I'm trying to push my artifact in that job.
But for the push to work, I have to use the release identifier given by actions/create-release@v1.0.0
, which run in another job.
Hence my question : how can I pass the release URL from my release creation job to the job that will push artifact ?
THe full workflow is available here : https://github.com/Riduidel/rrss2imap/blob/master/.github/workflows/on_tag.yml
And I copy it here
name: Push release artifacts on tag
on:
push:
tags:
- '[0-9]+.[0-9]+.[0-9]+'
jobs:
Make_GitHub_Release:
name: Create Release
runs-on: ubuntu-latest
steps:
- name: Create Release
id: create_release
uses: actions/create-release@v1.0.0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ github.ref }}
draft: true
prerelease: false
Standard_OS_build:
name: Build on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest]
# os: [ubuntu-latest, macOS-latest]
steps:
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
- uses: actions/checkout@master
# see https://github.com/marketplace/actions/rust-cargo
- uses: actions-rs/cargo@v1
with:
command: build
args: --release --all-features
- uses: olegtarasov/get-tag@v1
- name: Upload matrix release asset
id: upload-release-asset
uses: actions/upload-release-asset@v1.0.1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
# Doesn't work, since I can't access the first job from this one
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_name: rrss2imap_${{ matrix.os }}
asset_path: target/release/rrss2imap
asset_content_type: application/octet-stream
needs: Make_GitHub_Release
Windows_build:
name: Build on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [windows-latest]
steps:
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
- uses: actions/checkout@master
# see https://github.com/marketplace/actions/rust-cargo
- uses: actions-rs/cargo@v1
with:
command: build
args: --release --all-features
- uses: olegtarasov/get-tag@v1
- name: Upload Windows asset
id: upload-release-asset
uses: actions/upload-release-asset@v1.0.1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
# Doesn't work, since I can't access the first job from this one
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_name: rrss2imap_${{ matrix.os }}
asset_path: target/release/rrss2imap.exe
asset_content_type: application/vnd.microsoft.portable-executable
needs: Make_GitHub_Release
Cross_build_for_Raspbian:
name: Build for Raspbian
runs-on: ubuntu-latest
steps:
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
target: armv7-unknown-linux-gnueabihf
override: true
- uses: actions/checkout@master
# see https://github.com/marketplace/actions/rust-cargo
- uses: actions-rs/cargo@v1
with:
use-cross: true
command: build
args: --release --all-features
- uses: olegtarasov/get-tag@v1
- name: Upload matrix release asset
id: upload-release-asset
uses: actions/upload-release-asset@v1.0.1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
# Doesn't work, since I can't access the first job from this one
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_name: rrss2imap_${{ matrix.os }}
asset_path: target/release/rrss2imap
asset_content_type: application/octet-stream
needs: Make_GitHub_Release