Skip to content

Prepare v0.1.2 release #4

Prepare v0.1.2 release

Prepare v0.1.2 release #4

Workflow file for this run

# ********************************************************************************
# Copyright (c) 2024 Contributors to the Eclipse Foundation
#
# See the NOTICE file(s) distributed with this work for additional
# information regarding copyright ownership.
#
# This program and the accompanying materials are made available under the
# terms of the Apache License Version 2.0 which is available at
# https://www.apache.org/licenses/LICENSE-2.0
#
# SPDX-License-Identifier: Apache-2.0
# *******************************************************************************/
# Create artifacts for project releases
# Note: might also include crates.io publication step, if we're confident about our overall workflow
name: Release
on:
push:
tags:
- v*
workflow_dispatch:
concurrency:
group: "release-${{ github.head_ref || github.ref }}"
cancel-in-progress: true
jobs:
check:
uses: ./.github/workflows/check.yaml
coverage:
uses: ./.github/workflows/coverage.yaml
licenses:
# This works off the license declarations in dependent packages/crates, so if these declarations are wrong, this report will contain erroneous information
uses: ./.github/workflows/license-report.yaml
release:
name: collect workflow artifacts
runs-on: ubuntu-latest
needs:
- check
- coverage
- licenses
steps:
- uses: actions/checkout@v4
with:
submodules: "recursive"
- name: Upload README
id: upload_readme
uses: actions/upload-artifact@v4
with:
name: readme
path: README.md
- name: Collect quality artifacts
uses: anotherdaniel/[email protected]
id: quevee
with:
release_url: ${{ github.ref_name }}
artifacts_license: ${{ needs.licenses.outputs.license_report_url }}
artifacts_readme: ${{ steps.upload_readme.outputs.artifact-url }}
artifacts_testing: ${{ needs.check.outputs.test_results_url }},${{ needs.coverage.outputs.test_coverage_url }}
- name: Store quality manifest as workflow artifact
uses: actions/upload-artifact@v4
with:
name: quality-artifacts-manifest
path: ${{ steps.quevee.outputs.manifest_file }}
tag_release_artifacts:
# This only runs if this workflow is initiated via a tag-push with pattern 'v*'
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
name: collect v-tag release artifacts
runs-on: ubuntu-latest
needs:
- check
- coverage
- licenses
permissions: write-all
steps:
- uses: actions/checkout@v4
with:
submodules: "recursive"
# License report - we later need the download_url output of the upload step
- name: Download license report
uses: actions/download-artifact@v4
with:
name: license-report
path: dist/license/
- name: Upload license report to release
uses: svenstaro/upload-release-action@v2
id: upload_license_report
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: dist/license/*
file_glob: true
tag: ${{ github.ref }}
# Test report - we later need the download_url output of the upload step
- name: Download test report
uses: actions/download-artifact@v4
with:
name: test-results
path: dist/tests/
- name: Upload test report to release
uses: svenstaro/upload-release-action@v2
id: upload_test_report
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: dist/tests/*
file_glob: true
tag: ${{ github.ref }}
# Test coverage - we later need the download_url output of the upload step
- name: Download test coverage
uses: actions/download-artifact@v4
with:
name: code-coverage-html
path: dist/codecov/
- name: Upload test coverage to release
uses: svenstaro/upload-release-action@v2
id: upload_test_coverage
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: dist/codecov/*
file_glob: true
tag: ${{ github.ref }}
# README - we later need the download_url output of the upload step
- name: Upload README to release
uses: svenstaro/upload-release-action@v2
id: upload_readme
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: README.md
tag: ${{ github.ref }}
- name: Gets latest created release info
id: latest_release_info
uses: joutvhu/get-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Collect quality artifacts
uses: anotherdaniel/[email protected]
id: quevee_manifest
with:
release_url: ${{ steps.latest_release_info.outputs.html_url }}
artifacts_license: ${{ steps.upload_license_report.outputs.browser_download_url }}
artifacts_readme: ${{ steps.upload_readme.outputs.browser_download_url }}
artifacts_testing: ${{ steps.upload_test_report.outputs.browser_download_url }},${{ steps.upload_test_coverage.outputs.browser_download_url }}
- name: Upload manifest to release
uses: svenstaro/upload-release-action@v2
id: upload_quality_manifest
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: ${{ steps.quevee_manifest.outputs.manifest_file }}
tag: ${{ github.ref }}
cargo-publish:
name: publish to crates.io
# This will publish to crates.io if secrets.CRATES_TOKEN is set in the workspace, otherwise do a dry-run
runs-on: ubuntu-latest
needs:
- tag_release_artifacts
env:
CRATES_TOKEN: ${{ secrets.CRATES_IO_TOKEN }}
steps:
- uses: actions/checkout@v4
with:
submodules: "recursive"
- if: env.CRATES_TOKEN == ''
run: cargo publish --all-features --dry-run
- if: env.CRATES_TOKEN != ''
run: cargo publish --all-features --token ${CRATES_TOKEN}