Skip to content

Prepare v0.4.0 release #3

Prepare v0.4.0 release

Prepare v0.4.0 release #3

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
name: Release
on:
push:
tags:
- v*
concurrency:
group: "release-${{ github.head_ref || github.ref }}"
cancel-in-progress: true
jobs:
check:
uses: ./.github/workflows/check.yaml
check-msrv:
uses: eclipse-uprotocol/ci-cd/.github/workflows/rust-verify-msrv.yaml@main
coverage:
uses: eclipse-uprotocol/ci-cd/.github/workflows/rust-coverage.yaml@main
current-spec-compliance:
runs-on: ubuntu-latest
# we do not invoke the corresponding job from ci-cd repo
# because we do not want the job to fail if not all requirements
# are covered (yet)
steps:
- uses: actions/checkout@v4
with:
submodules: "recursive"
- name: "Determine OpenFastTrace file patterns from .env file"
uses: xom9ikk/dotenv@v2.3.0
with:
mode: "oft-current"
load-mode: strict
# this will run OFT and upload the results
- name: Run OpenFastTrace
id: run-oft
uses: eclipse-uprotocol/ci-cd/.github/actions/run-oft@main
with:
file-patterns: "${{ env.OFT_FILE_PATTERNS }}"
tags: "${{ env.OFT_TAGS_}}"
licenses:
# This works off the license declarations in dependent packages/crates, so if these declarations are wrong, this report will contain erroneous information
uses: eclipse-uprotocol/ci-cd/.github/workflows/rust-license-report.yaml@main
with:
templates: "about.hbs"
config: "about.toml"
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
- check-msrv
- coverage
- current-spec-compliance
- licenses
permissions: write-all
steps:
- uses: actions/checkout@v4
with:
submodules: "recursive"
- name: "Determine uProtocol Specification file patterns from .env file"
uses: xom9ikk/dotenv@v2.3.0
with:
mode: oft-current
load-mode: strict
# 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 }}
# Requirements Tracing report - we later need the download_url output of the upload step
- name: Download requirements tracing report
uses: actions/download-artifact@v4
with:
name: tracing-report-html
path: dist/tracing/
- name: Upload requirements tracing report to release
uses: svenstaro/upload-release-action@v2
id: upload_requirements_tracing_report
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: dist/tracing/*
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: Gather uProtocol Specification documents
shell: bash
run: |
tar cvz --file up-spec.tar.gz ${{ env.UP_SPEC_FILE_PATTERNS }}
- name: Upload relevant uProtocol Spec files to release
uses: svenstaro/upload-release-action@v2
id: upload_up_spec
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: up-spec.tar.gz
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: eclipse-dash/quevee@v1
id: quevee_manifest
with:
release_url: ${{ steps.latest_release_info.outputs.html_url }}
artifacts_documentation: ${{ steps.upload_up_spec.outputs.browser_download_url }}
artifacts_readme: ${{ steps.upload_readme.outputs.browser_download_url }}
artifacts_requirements: ${{ steps.upload_up_spec.outputs.browser_download_url }}
artifacts_testing: ${{ steps.upload_test_report.outputs.browser_download_url }},${{ steps.upload_test_coverage.outputs.browser_download_url }},${{ steps.upload_requirements_tracing_report.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}