Skip to content

Commit

Permalink
Publish release in workflow
Browse files Browse the repository at this point in the history
Signed-off-by: Ismael González <[email protected]>
  • Loading branch information
ismaelgv committed Nov 6, 2021
1 parent 5b37089 commit 736778d
Showing 1 changed file with 26 additions and 17 deletions.
43 changes: 26 additions & 17 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ on:
env:
PROJECT_NAME: rnr
CARGO_TERM_COLOR: always
ARTIFACT_NAME: artifacts

jobs:
build-artifacts:
Expand Down Expand Up @@ -42,46 +43,54 @@ jobs:
toolchain: stable
profile: minimal
target: ${{ env.TARGET }}
override: true

- name: Build
shell: bash
run: |
cargo build --target=${TARGET} --release --verbose
- name: Create package
id: package
shell: bash
env:
VERSION: ${{ steps.version.outputs.version }}
run: |
out_dir=${GITHUB_WORKSPACE}
package_name="${PROJECT_NAME}-${VERSION}-${TARGET}"
ext=".tag.gz"
deploy_dir="${BUILD_DIR}/${package_name}"
# Create deployment directory
mkdir "${deploy_dir}"
mkdir "${deploy_dir}/completion"
mkdir -p "${deploy_dir}"
mkdir -p "${deploy_dir}/completion"
# Copy files
cp "target/${TARGET}/release/${PROJECT_NAME}" "${deploy_dir}/"
cp "target/${TARGET}/release/build/rnr"-*/out/"_rnr" "${deploy_dir}/completion/"
cp "target/${TARGET}/release/build/rnr"-*/out/"rnr.bash" "${deploy_dir}/completion/"
cp "target/${TARGET}/release/build/rnr"-*/out/"rnr.fish" "${deploy_dir}/completion/"
cp "target/${TARGET}/release/build/rnr"-*/out/"_rnr.ps1" "${deploy_dir}/completion/"
cp "target/${TARGET}/release/${PROJECT_NAME}" "${deploy_dir}/"
cp "target/${TARGET}/release/build/rnr"-*/out/"_rnr" "${deploy_dir}/completion/"
cp "target/${TARGET}/release/build/rnr"-*/out/"rnr.bash" "${deploy_dir}/completion/"
cp "target/${TARGET}/release/build/rnr"-*/out/"rnr.fish" "${deploy_dir}/completion/"
cp "target/${TARGET}/release/build/rnr"-*/out/"_rnr.ps1" "${deploy_dir}/completion/"
cp README.md "${deploy_dir}"
cp LICENSE "${deploy_dir}"
# Archive
pushd "${tempdir}"
tar czf "${out_dir}/${package_name}.tar.gz" "${package_name}"/*
tar czf "${GITHUB_WORKSPACE}/${package_name}${ext}" "${package_name}"/*
popd
rm -r "${tempdir}"
echo ::set-output name=name::${package_name}${ext}
- name: Store artifacts
run: echo TODO
uses: actions/upload-artifact@v2
with:
name: artifacts
path: ${steps.package.outputs.name}

publish-release:
name: Publish a new release
runs-on: ubuntu-latest
needs: build-artifacts
steps:
- name: Get the version
id: version
Expand All @@ -90,12 +99,12 @@ jobs:
echo ::set-output name=version::${GITHUB_REF/refs\/tags\//}
- name: Fetch artifacts
run: echo TODO
uses: actions/download-artifact@v2
with:
name: artifacts

- name: Publish new release
run: echo TODO
# uses: softprops/action-gh-release@v1
# with:
# name: ${{ steps.version.outputs.version }}
# artifacts: ""
# body: ""
uses: softprops/action-gh-release@v1
with:
name: ${{ steps.version.outputs.version }}
artifacts: ${{ env.ARTIFACT_NAME }}

0 comments on commit 736778d

Please sign in to comment.