Nightly branch #1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Nightly build | |
on: | |
workflow_dispatch: # TEMPORARY: remove before merging PR | |
schedule: | |
- cron: "0 5 * * *" # 0500 UTC every day | |
jobs: | |
# Create snapshot of main branch for nightly build | |
nightly-snapshot: | |
name: Create snapshot | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
token: ${{ secrets.GH_ADMIN_COMMIT_TOKEN }} | |
- name: Get latest existing tag | |
uses: actions-ecosystem/action-get-latest-tag@v1 | |
## NEEDS UPDATE for set-output deprecation. | |
## See https://github.com/actions-ecosystem/action-get-latest-tag/issues/25. | |
id: get-latest-tag | |
with: | |
semver_only: true | |
- name: Set new version | |
uses: paulhatch/semantic-version@v5.2.1 | |
id: set-version | |
with: | |
tag_prefix: "v" | |
format: "${major}.${minor}.${patch}-nightly" | |
major_pattern: "(MAJOR)" | |
minor_pattern: "(MINOR)" | |
- name: Log version & changelog | |
run: | | |
echo "Version: $VERSION" | |
echo "Version tag: $VERSION_TAG" | |
echo "Latest tag detected: $LATEST_TAG" | |
env: | |
VERSION: ${{ steps.set-version.outputs.version }} | |
VERSION_TAG: ${{ steps.set-version.outputs.version_tag }} | |
LATEST_TAG: ${{ steps.get-latest-tag.outputs.tag }} | |
# - name: Prevent empty release | |
# if: ${{ steps.generate-changelog.outputs.stdout == '' }} | |
# uses: actions/github-script@v3 | |
# with: | |
# script: | | |
# core.setFailed("No changes since prior release") | |
# - name: Update changelog | |
# run: | | |
# (head -8 CHANGELOG.md && echo "## $VERSION" && date "+_%d %B %Y_" && echo "" && (echo "$CHANGELOG" | sed -E 's_\(#([0-9]+)\)_([#\1](https://github.com/contentauth/c2pa-rs/pull/\1)\)_') && tail -n +9 CHANGELOG.md) > CHANGELOG.new.md | |
# mv CHANGELOG.new.md CHANGELOG.md | |
# env: | |
# VERSION: ${{ steps.set-version.outputs.version }} | |
# CHANGELOG: ${{ steps.generate-changelog.outputs.stdout }} | |
# - name: Install Rust toolchain | |
# uses: actions-rs/toolchain@v1 | |
# with: | |
# toolchain: stable | |
# - name: Bump crate versions | |
# run: | | |
# sed -i "s/^version = \"[^\"]*\"$/version = \"$VERSION\"/;" Cargo.toml | |
# env: | |
# VERSION: ${{ steps.set-version.outputs.version }} | |
# - name: Update Cargo.lock | |
# run: | | |
# cargo update -p c2patool | |
# - name: Report differences for "prepare (release)" commit | |
# run: git diff | |
# - name: Commit Cargo.toml, Cargo.lock, and changelog | |
# uses: stefanzweifel/git-auto-commit-action@v4 | |
# ## NEEDS UPDATE for set-output deprecation. | |
# ## See https://github.com/stefanzweifel/git-auto-commit-action/issues/250. | |
# id: commit | |
# with: | |
# commit_message: Prepare ${{ steps.set-version.outputs.version }} release | |
# commit_user_name: Adobe CAI Team | |
# commit_user_email: noreply@adobe.com | |
# - name: Create GitHub release | |
# uses: ncipollo/release-action@v1 | |
# with: | |
# body: ${{ steps.generate-changelog.outputs.stdout }} | |
# commit: ${{ steps.commit.outputs.commit_hash }} | |
# prerelease: true # remove at 1.0 | |
# tag: ${{ steps.set-version.outputs.version_tag }} | |
# token: ${{ secrets.GH_ADMIN_COMMIT_TOKEN }} | |
# # make this into build step | |
# tests: | |
# name: Unit tests | |
# runs-on: ${{ matrix.os }} | |
# strategy: | |
# fail-fast: false | |
# matrix: | |
# os: [windows-latest, macos-latest, ubuntu-latest] | |
# rust_version: [stable, 1.70.0] | |
# steps: | |
# - name: Checkout repository | |
# uses: actions/checkout@v3 | |
# - name: Install Rust toolchain | |
# uses: dtolnay/rust-toolchain@master | |
# with: | |
# toolchain: ${{ matrix.rust_version }} | |
# components: llvm-tools-preview | |
# - name: Cache Rust dependencies | |
# uses: Swatinem/rust-cache@v1 | |
# - name: Install cargo-llvm-cov | |
# uses: taiki-e/install-action@cargo-llvm-cov | |
# - name: Generate code coverage | |
# run: cargo llvm-cov --all-features --workspace --lcov --output-path lcov.info | |
# - name: Upload code coverage results | |
# uses: codecov/codecov-action@v3 | |
# with: | |
# token: ${{ secrets.CODECOV_TOKEN }} | |
# fail_ci_if_error: true | |
# verbose: true |