Skip to content

Commit

Permalink
fix: Make tag-crates less confusing
Browse files Browse the repository at this point in the history
- Rename live-run to dry-run
- Make live-run optional
- Always auto-generate verison if not provided
  • Loading branch information
fuzzypixelz committed Mar 5, 2024
1 parent 6123a40 commit 48ff4cc
Show file tree
Hide file tree
Showing 24 changed files with 111 additions and 119 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/publish-crates-cargo.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ on:
repos:
type: string
required: true
dry-run:
live-run:
type: string
required: true
branch:
Expand All @@ -20,7 +20,7 @@ on:
repos:
type: string
required: true
dry-run:
live-run:
type: string
required: true
branch:
Expand All @@ -37,7 +37,7 @@ jobs:
- uses: eclipse-zenoh/ci/publish-crates-cargo@main
with:
repos: ${{ inputs.repos }}
dry-run: ${{ inputs.dry-run }}
live-run: ${{ inputs.live-run }}
branch: ${{ inputs.branch }}
inter-deps-pattern: ${{ inputs.inter-deps-pattern }}
github-token: ${{ secrets.BOT_TOKEN_WORKFLOW }}
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/publish-crates-debian.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@ name: Publish crates (Debian)
on:
workflow_call:
inputs:
dry-run:
live-run:
type: string
required: true
version:
type: string
required: true
workflow_dispatch:
inputs:
dry-run:
live-run:
type: string
required: true
version:
Expand All @@ -24,7 +24,7 @@ jobs:
steps:
- uses: eclipse-zenoh/ci/publish-crates-debian@main
with:
dry-run: ${{ inputs.dry-run }}
live-run: ${{ inputs.live-run }}
version: ${{ inputs.version }}
ssh-host: [email protected]
ssh-host-path: /home/data/httpd/download.eclipse.org/zenoh/debian-repo
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/publish-crates-eclipse.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: Publish crates (Eclipse)
on:
workflow_call:
inputs:
dry-run:
live-run:
type: string
required: true
version:
Expand All @@ -14,7 +14,7 @@ on:
required: true
workflow_dispatch:
inputs:
dry-run:
live-run:
type: string
required: true
version:
Expand All @@ -30,7 +30,7 @@ jobs:
steps:
- uses: eclipse-zenoh/ci/publish-crates-eclipse@main
with:
dry-run: ${{ inputs.dry-run }}
live-run: ${{ inputs.live-run }}
version: ${{ inputs.version }}
ssh-host: [email protected]
ssh-host-path: /home/data/httpd/download.eclipse.org/${{ inputs.name }}
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/publish-crates-github.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ on:
repo:
type: string
required: true
dry-run:
live-run:
type: string
required: true
version:
Expand All @@ -20,7 +20,7 @@ on:
repo:
type: string
required: true
dry-run:
live-run:
type: string
required: true
version:
Expand All @@ -37,7 +37,7 @@ jobs:
- uses: eclipse-zenoh/ci/publish-crates-github@main
with:
repo: ${{ inputs.repo }}
dry-run: ${{ inputs.dry-run }}
live-run: ${{ inputs.live-run }}
version: ${{ inputs.version }}
branch: ${{ inputs.branch }}
ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }}
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/publish-crates-homebrew.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ on:
repo:
type: string
required: true
dry-run:
live-run:
type: string
required: true
version:
Expand All @@ -26,7 +26,7 @@ on:
repo:
type: string
required: true
dry-run:
live-run:
type: string
required: true
version:
Expand All @@ -49,7 +49,7 @@ jobs:
- uses: eclipse-zenoh/ci/publish-crates-homebrew@main
with:
repo: ${{ inputs.repo }}
dry-run: ${{ inputs.dry-run }}
live-run: ${{ inputs.live-run }}
version: ${{ inputs.version }}
branch: ${{ inputs.branch }}
formulae: ${{ inputs.formulae }}
Expand Down
14 changes: 7 additions & 7 deletions .github/workflows/tag-crates.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ on:
repo:
type: string
required: true
dry-run:
live-run:
type: boolean
required: true
required: false
version:
type: string
required: true
required: false
inter-deps-pattern:
type: string
required: true
Expand All @@ -28,12 +28,12 @@ on:
repo:
type: string
required: true
dry-run:
live-run:
type: boolean
required: true
required: false
version:
type: string
required: true
required: false
inter-deps-pattern:
type: string
required: true
Expand All @@ -52,7 +52,7 @@ jobs:
uses: eclipse-zenoh/ci/tag-crates@main
with:
repo: ${{ inputs.repo }}
dry-run: ${{ inputs.dry-run }}
live-run: ${{ inputs.live-run }}
version: ${{ inputs.version }}
inter-deps-pattern: ${{ inputs.inter-deps-pattern }}
inter-deps-version: ${{ inputs.inter-deps-version }}
Expand Down
8 changes: 4 additions & 4 deletions dist/publish-crates-cargo-main.js
Original file line number Diff line number Diff line change
Expand Up @@ -82273,14 +82273,14 @@ async function spawn() {


function setup() {
const dryRun = lib_core.getBooleanInput("dry-run", { required: true });
const liveRun = lib_core.getInput("live-run");
const branch = lib_core.getInput("branch", { required: true });
const repos = lib_core.getInput("repos", { required: true });
const githubToken = lib_core.getInput("github-token", { required: true });
const interDepsPattern = lib_core.getInput("inter-deps-pattern", { required: true });
const cratesIoToken = lib_core.getInput("crates-io-token", { required: true });
return {
dryRun,
liveRun: liveRun == "" ? false : lib_core.getBooleanInput("live-run"),
branch,
repos: repos.split("\n"),
githubToken,
Expand All @@ -82299,7 +82299,7 @@ async function main(input) {
await deleteRepos(input);
lib_core.endGroup();
}
if (!input.dryRun) {
if (input.liveRun) {
for (const repo of input.repos) {
lib_core.startGroup(`Publishing ${repo} to crates.io`);
clone(repo, input);
Expand All @@ -82316,7 +82316,7 @@ async function main(input) {
}
}
async function cleanup(input, registry) {
if (input.dryRun) {
if (input.liveRun) {
lib_core.info(`Killing estuary process (${registry.proc.pid})`);
try {
process.kill(registry.proc.pid);
Expand Down
6 changes: 3 additions & 3 deletions dist/publish-crates-debian-main.js
Original file line number Diff line number Diff line change
Expand Up @@ -121416,14 +121416,14 @@ const publish_crates_debian_artifact = new artifact.DefaultArtifactClient();
const sourcesListName = "publish-crates-debian.list";
const sourcesListDir = "/etc/apt/sources.list.d";
function setup() {
const dryRun = core.getBooleanInput("dry-run", { required: true });
const liveRun = core.getInput("live-run");
const version = core.getInput("version", { required: true });
const sshHost = core.getInput("ssh-host", { required: true });
const sshHostPath = core.getInput("ssh-host-path", { required: true });
const sshPrivateKey = core.getInput("ssh-private-key", { required: true });
const sshPassphrase = core.getInput("ssh-passphrase", { required: true });
return {
dryRun,
liveRun: liveRun == "" ? false : core.getBooleanInput("live-run"),
version,
sshHost,
sshHostPath,
Expand Down Expand Up @@ -121487,7 +121487,7 @@ async function main(input) {
debs.forEach(deb => {
sh(`sudo dpkg --purge --force-all ${deb}`);
});
if (!input.dryRun) {
if (input.liveRun) {
await withIdentity(input.sshPrivateKey, input.sshPassphrase, env => {
const files = [allPackagesGzippedPath, packagesPath, input.version].join(" ");
sh(`ssh -v -o StrictHostKeyChecking=no ${input.sshHost} mkdir -p ${input.sshHostPath}`, { env });
Expand Down
6 changes: 3 additions & 3 deletions dist/publish-crates-eclipse-main.js
Original file line number Diff line number Diff line change
Expand Up @@ -121406,14 +121406,14 @@ async function withIdentity(privateKey, passphrase, fn) {

const publish_crates_eclipse_artifact = new artifact.DefaultArtifactClient();
function setup() {
const dryRun = core.getBooleanInput("dry-run", { required: true });
const liveRun = core.getInput("live-run");
const version = core.getInput("version", { required: true });
const sshHost = core.getInput("ssh-host", { required: true });
const sshHostPath = core.getInput("ssh-host-path", { required: true });
const sshPrivateKey = core.getInput("ssh-private-key", { required: true });
const sshPassphrase = core.getInput("ssh-passphrase", { required: true });
return {
dryRun,
liveRun: liveRun == "" ? false : core.getBooleanInput("live-run"),
version,
sshHost,
sshHostPath,
Expand All @@ -121430,7 +121430,7 @@ async function main(input) {
const archive = `${downloadPath}/${result.name}.zip`;
const sshTarget = `${input.sshHost}:${input.sshHostPath}/${input.version}`;
core.info(`Uploading ${archive} to eclipse.org`);
if (!input.dryRun) {
if (input.liveRun) {
await withIdentity(input.sshPrivateKey, input.sshPassphrase, env => {
sh(`scp -v -o StrictHostKeyChecking=no -r ${archive} ${sshTarget}`, { env });
});
Expand Down
10 changes: 5 additions & 5 deletions dist/publish-crates-github-main.js
Original file line number Diff line number Diff line change
Expand Up @@ -121387,15 +121387,15 @@ var external_path_default = /*#__PURE__*/__nccwpck_require__.n(external_path_);

const publish_crates_github_artifact = new artifact.DefaultArtifactClient();
function setup() {
const dryRun = core.getBooleanInput("dry-run", { required: true });
const liveRun = core.getInput("live-run");
const repo = core.getInput("repo", { required: true });
const version = core.getInput("version", { required: true });
const branch = core.getInput("branch", { required: true });
const sshPrivateKey = core.getInput("ssh-private-key", { required: true });
const sshPassphrase = core.getInput("ssh-passphrase", { required: true });
const githubToken = core.getInput("github-token", { required: true });
return {
dryRun,
liveRun: liveRun == "" ? false : core.getBooleanInput("live-run"),
version,
branch,
repo,
Expand All @@ -121410,17 +121410,17 @@ async function main(input) {
GH_TOKEN: input.githubToken,
};
const startTag = sh("git describe --tags --abbrev=0");
if (!input.dryRun) {
if (input.liveRun) {
sh(`gh release create ${input.version} --repo ${input.repo} --target ${input.branch} \
--notes-start-tag ${startTag} --verify-tag --generate-notes`, { env });
--notes-start-tag ${startTag} --verify-tag --generate-notes`, { env });
}
const results = await publish_crates_github_artifact.listArtifacts({ latest: true });
for (const result of results.artifacts) {
if (/^.*-artifacts$/g.test(result.name)) {
const { downloadPath } = await publish_crates_github_artifact.downloadArtifact(result.id);
const archive = external_path_default().join(downloadPath, `${result.name}.zip`);
core.info(`Uploading ${archive} to github.com/${input.repo}`);
if (!input.dryRun) {
if (input.liveRun) {
sh(`gh release upload ${input.version} ${archive} --repo ${input.repo} --clobber`, { env });
}
}
Expand Down
10 changes: 5 additions & 5 deletions dist/publish-crates-homebrew-main.js
Original file line number Diff line number Diff line change
Expand Up @@ -24835,7 +24835,7 @@ function fromFiles(output, ...files) {


function setup() {
const dryRun = core.getBooleanInput("dry-run", { required: true });
const liveRun = core.getInput("live-run");
const version = core.getInput("version", { required: true });
const repo = core.getInput("repo", { required: true });
const branch = core.getInput("branch", { required: true });
Expand All @@ -24851,7 +24851,7 @@ function setup() {
const actorName = core.getInput("actor-name", { required: true });
const actorEmail = core.getInput("actor-email", { required: true });
return {
dryRun,
liveRun: liveRun == "" ? false : core.getBooleanInput("live-run"),
version,
repo,
branch,
Expand Down Expand Up @@ -24894,7 +24894,7 @@ async function main(input) {
for (const target of TARGETS) {
const outputArchive = `${repo}-${input.version}-${target}.zip`;
await fromDirectory(outputArchive, external_path_.join(repo, "target", target, "release"), input.artifactRegExp);
if (!input.dryRun) {
if (input.liveRun) {
await withIdentity(input.sshPrivateKey, input.sshPassphrase, env => {
sh(`ssh -v -o StrictHostKeyChecking=no ${input.sshHost} mkdir -p ${input.sshHostPath}`, { env });
sh(`scp -v -o StrictHostKeyChecking=no -r ${outputArchive} ${input.sshHost}:${input.sshHostPath}`, { env });
Expand All @@ -24912,7 +24912,7 @@ async function main(input) {
return external_crypto_.createHash("sha256").update(contents).digest("hex");
};
const url = (target) => {
const baseUrl = input.dryRun ? `file://${process.cwd()}` : input.sshHostUrl;
const baseUrl = input.liveRun ? input.sshHostUrl : `file://${process.cwd()}`;
return `${baseUrl}/${repo}-${input.version}-${target}.zip`;
};
for (const formula of input.formulae) {
Expand All @@ -24931,7 +24931,7 @@ async function main(input) {
sh(`brew install --force ${formula}`);
sh(`brew uninstall --force --ignore-dependencies ${formula}`);
}
if (!input.dryRun) {
if (input.liveRun) {
sh(`git push ${tapUrl}`, { cwd: tapPath });
}
cleanup(input);
Expand Down
Loading

0 comments on commit 48ff4cc

Please sign in to comment.