-
Notifications
You must be signed in to change notification settings - Fork 83
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
88 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
# Cut a release whenever a new tag is pushed to the repo. | ||
# You should use an annotated tag, like `git tag -a v1.2.3` | ||
# and put the release notes into the commit message for the tag. | ||
name: Release | ||
|
||
on: | ||
push: | ||
tags: | ||
- "v*.*.*" | ||
|
||
permissions: | ||
contents: write | ||
|
||
jobs: | ||
tests: | ||
# Do only release when CI succeeds. | ||
uses: ./.github/workflows/workflow.yaml | ||
|
||
release: | ||
# Do only release when CI succeeds. | ||
needs: [test-nixpkgs, test-examples] | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
- name: Prepare release notes and artifacts | ||
run: .github/workflows/release_prep.sh ${{ env.GITHUB_REF_NAME }} > release_notes.txt | ||
- name: Release | ||
uses: softprops/action-gh-release@v1 | ||
with: | ||
draft: true | ||
prerelease: true | ||
# Use GH feature to populate the changelog automatically | ||
generate_release_notes: true | ||
body_path: release_notes.txt | ||
fail_on_unmatched_files: true | ||
files: rules_nixpkgs*-*.tar.gz |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
#!/usr/bin/env bash | ||
set -euo pipefail | ||
|
||
# Set by GH actions, see | ||
# https://docs.github.com/en/actions/learn-github-actions/environment-variables#default-environment-variables | ||
TAG=${GITHUB_REF_NAME} | ||
# The prefix is chosen to match what GitHub generates for source archives | ||
PREFIX="rules_nixpkgs-${TAG:1}" | ||
ARCHIVE="rules_nixpkgs-${TAG:1}.tar.gz" | ||
git archive --format=tar.gz --prefix="${PREFIX}/" -o $ARCHIVE ${TAG} | ||
SHA=$(shasum -a 256 "$ARCHIVE" | awk '{print $1}') | ||
|
||
cat << EOF | ||
## Using Bzlmod with Bazel 6 | ||
1. Enable with \`common --enable_bzlmod\` in \`.bazelrc\`. | ||
2. Add to your \`MODULE.bazel\` file: | ||
\`\`\`starlark | ||
bazel_dep(name = "rules_nixpkgs_core", version = "${TAG:1}") | ||
\`\`\` | ||
## Using WORKSPACE | ||
Paste this snippet into your `WORKSPACE.bazel` file: | ||
\`\`\`starlark | ||
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") | ||
http_archive( | ||
name = "rules_nixpkgs", | ||
sha256 = "${SHA}", | ||
strip_prefix = "${PREFIX}", | ||
url = "https://github.com/myorg/rules_nixpkgs/releases/download/${TAG}/${ARCHIVE}", | ||
) | ||
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") | ||
http_archive( | ||
name = "io_tweag_rules_nixpkgs", | ||
strip_prefix = "$PREFIX", | ||
urls = ["https://github.com/tweag/rules_nixpkgs/releases/download/$TAG/$ARCHIVE"], | ||
) | ||
load("@io_tweag_rules_nixpkgs//nixpkgs:repositories.bzl", "rules_nixpkgs_dependencies") | ||
rules_nixpkgs_dependencies() | ||
load("@io_tweag_rules_nixpkgs//nixpkgs:nixpkgs.bzl", "nixpkgs_git_repository", "nixpkgs_package", "nixpkgs_cc_configure") | ||
load("@io_tweag_rules_nixpkgs//nixpkgs:toolchains/go.bzl", "nixpkgs_go_configure") # optional | ||
\`\`\` | ||
EOF |