Skip to content

A GitHub Action for publishing the artifacts to GitHub Releases and code packages to the package repositories

License

Notifications You must be signed in to change notification settings

Reloaded-Project/devops-publish-action

Use this GitHub action with your project
Add this Action to an existing workflow or create a new one
View on Marketplace

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

52 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Logo

Reloaded Publish Action

License

This GitHub Action is designed to streamline the publishing process for Reloaded projects by automatically detecting and uploading artifacts to the appropriate locations, such as GitHub Releases, NuGet, and crates.io.

Features

  • πŸ“¦ Download artifacts generated by other GitHub Actions
  • πŸš€ Upload artifacts to GitHub Releases
  • πŸ“¦ Publish NuGet packages to nuget.org
  • πŸ¦€ Publish Rust packages to crates.io
  • πŸ“ Generate changelogs via devops-changelog
  • πŸ” Automatically detect and upload the appropriate artifacts

Usage

To use this action in your GitHub workflow, add the following step:

publish-crate:
  permissions:
    contents: write

  # Dependencies that produce publish-able artifacts.
  needs: [build-and-test,build-c-headers,build-dotnet-library]

  # Publish only on tags
  if: startsWith(github.ref, 'refs/tags/') 
  runs-on: ubuntu-latest
  steps:
  - uses: actions/checkout@v4

  - name: Publish artifacts
    uses: Reloaded-Project/devops-publish-action@v3
    with:
      csharp-nuget-api-key: ${{ secrets.NUGET_KEY }}
      rust-crates-io-token: ${{ secrets.CRATES_IO_TOKEN }}
      
      # For standalone Rust projects, specify paths to the project directories
      rust-cargo-project-paths: |
        ./path/to/rust/project1
        ./path/to/rust/project2
        
      # For Cargo workspace projects, specify the workspace root and crate names
      rust-cargo-workspace-root: ./path/to/workspace
      rust-cargo-workspace-crates: |
        crate_name1
        crate_name2

Inputs

General Parameters

Input Description Required Default
artifacts-directory Path to the directory containing the artifacts No artifacts
compressed-artifacts-directory Path to the directory containing the zipped artifacts No compressed-artifacts
create-release Whether the artifacts should be uploaded to GitHub Releases No true
checkout-current-repo Checks out the current repository No true

Compression Parameters

Input Description Required Default
artifact-groups-file Path to YAML file for grouping artifact directories into archives No .github/artifact-groups.yml
compression-tool Compression tool to use (zip, 7z) No zip
compression-args Additional arguments for the compression tool No ''

Artifact Groups Examples

Create a .github/artifact-groups.yml file in your repository to configure how artifact directories are grouped into archives. If the file doesn't exist, each artifact directory is compressed individually.

Example .github/artifact-groups.yml:

# Explicit list - name specific directories to group
c-library:
  - c-library-linux-x64
  - c-library-windows-x64
  - c-library-macos-arm64

# Pattern matching (single string) with excludes (single string)
non-symbols:
  patterns: "*"
  excludes: "*.symbols"

# Multiple patterns and excludes (list)
binaries:
  patterns:
    - "linux-*"
    - "windows-*"
    - "macos-*"
  excludes:
    - "*-test"
    - "*-debug"

# Multiple flatten patterns (list)
headers:
  patterns: "C-Headers-*"
  flattens:
    - "*-bindings_c.h"
    - "*-bindings_cpp.hpp"

# Rename directories (search/replace on top-level dir names)
c-library:
  patterns: "C-Library-*"
  renames:
    - "C-Library-prs-rs-": ""  # Remove prefix

# Combined with flattens (renames apply after flattens)
binaries:
  patterns: "C-Library-*"
  flattens: "C-Library-linux-*"
  renames:
    - "C-Library-": ""

# Directories not matching any group remain as individual archives

Notes:

  • Directories not matching any group are compressed as individual archives
  • A directory can be included in multiple groups - each group independently matches directories, so overlapping patterns will result in the same directory appearing in multiple archives
  • patterns, excludes, and flattens accept either a single string or a list
  • The flattens option places files from matched directories directly at the archive root
  • The renames option applies search/replace transformations to top-level directory names
  • Renames are applied after flattens, in list order
  • renames uses list-of-dicts syntax: - "search": "replace"
  • If flattening or renaming would cause conflicts, the script fails with an error listing all conflicts

C#/NuGet Parameters

Input Description Required Default
csharp-nuget-api-key NuGet API key for publishing packages No
csharp-nuget-publish-params Additional parameters for dotnet nuget push No ''

Rust/Cargo Parameters

Input Description Required Default
rust-crates-io-token Crates.io token for publishing Rust packages No
rust-cargo-project-paths List of paths to standalone Rust projects No ''
rust-cargo-workspace-root Root path of the Cargo workspace No .
rust-cargo-workspace-crates List of specific crates to publish from a Cargo workspace No ''
rust-cargo-publish-params Additional parameters for cargo publish (e.g., --dry-run) No ''

Changelog Parameters

For detailed documentation on changelog options, see devops-changelog.

Control Inputs

Input Description Required Default
changelog-enabled Enable changelog generation No false
changelog-include-in-release Include changelog file in release assets No false
changelog-upload-artifact Upload changelog as GitHub artifact No false
changelog-artifact-name Name for the changelog artifact No Changelog

Auto-changelog Options

Input Description Required Default
changelog-output Output file path No CHANGELOG.md
changelog-config Path to auto-changelog config file No ''
changelog-template Template to use [compact, keepachangelog, json] No compact
changelog-remote Git remote for links No ''
changelog-package Use version from file as latest release No ''
changelog-latest-version Use specified version as latest release No ''
changelog-unreleased Include unreleased changes section No false
changelog-commit-limit Number of commits to display per release No ''
changelog-backfill-limit Number of commits to backfill empty releases No ''
changelog-commit-url Override commit URL, use {id} for commit id No ''
changelog-issue-url Override issue URL, use {id} for issue id No ''
changelog-merge-url Override merge URL, use {id} for merge id No ''
changelog-compare-url Override compare URL, use {from} and {to} for tags No ''
changelog-issue-pattern Override regex pattern for issues in commit messages No ''
changelog-breaking-pattern Regex pattern for breaking change commits No ''
changelog-merge-pattern Add custom regex pattern for merge commits No ''
changelog-commit-pattern Pattern to include when parsing commits No ''
changelog-ignore-commit-pattern Pattern to ignore when parsing commits No ''
changelog-tag-pattern Override regex pattern for version tags No ''
changelog-tag-prefix Prefix used in version tags No ''
changelog-starting-version Specify earliest version to include in changelog No ''
changelog-starting-date Specify earliest date to include in changelog No ''
changelog-ending-version Specify latest version to include in changelog No ''
changelog-sort-commits Sort commits by property [relevance, date, date-desc, subject, subject-desc] No relevance
changelog-release-summary Display tagged commit message body as release summary No false
changelog-unreleased-only Only output unreleased changes No false
changelog-hide-empty-releases Hide empty releases No false
changelog-hide-credit Hide auto-changelog credit No false
changelog-handlebars-setup Handlebars setup file No ''
changelog-append-git-log String to append to git log command No ''
changelog-append-git-tag String to append to git tag command No ''
changelog-prepend Prepend changelog to output file No false
changelog-stdout Output changelog to stdout No false
changelog-is-release Whether this is a GitHub Release No false
changelog-release-tag Tag associated with the GitHub Release No ''
changelog-override-starting-version Override the starting version with the release tag if this is a GitHub Release No false

How this Action Works

  • Downloads all artifacts and re-uploads them to the GitHub Releases.
  • Optionally generates a changelog using the devops-changelog action and uses it as the release body.
  • Uploads all NuGet packages stored in artifacts to nuget.org
  • Uploads specified Rust projects to crates.io using two different methods:
    • Standalone Projects: Use rust-cargo-project-paths with full paths to individual project directories. Publishes using --manifest-path.
    • Workspace Projects: Use rust-cargo-workspace-root + rust-cargo-workspace-crates to publish specific crates from a workspace by name. Publishes using -p flag.

Why this Action Exists

Reloaded projects produce various types of artifacts, such as binaries, libraries, NuGet packages, and Rust packages. This action makes it easy to publish these artifacts.

This action is designed to be used in conjunction with actions such as:

This action centralizes the publishing logic, ensuring consistency across projects and reducing maintenance overhead.

Contributing

Contributions are welcome!

If you encounter any issues or have suggestions for improvements, please open an issue or submit a pull request in this repository.

License

This project is licensed under the MIT License. See the LICENSE file for details.

About

A GitHub Action for publishing the artifacts to GitHub Releases and code packages to the package repositories

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 2

  •  
  •  

Languages