mirror of
https://github.com/awalsh128/cache-apt-pkgs-action.git
synced 2026-10-24 18:37:05 +00:00
Remove dependency on cache-apt-pkgs-action-ci repo
The action's own workflows (action-tests.yml) already run the same test
jobs as the -ci repo, against the local checkout before merge, so the
separate CI repo is redundant.
- Remove the pub_{master,dev,staging}_push_event.yml workflows that
dispatched events to the -ci repo (PUBLISH_PUSH_TOKEN secret can be
deleted from repository settings).
- Point the README test badges at action-tests.yml.
- Port the release-tag tooling (moves the v1 and latest tags) from the
-ci repo into scripts/release/ and add an update_release_tags
workflow. Scripts now operate on the current clone instead of
assuming a sibling checkout, run non-interactively when CI=true, and
fix the target-tag validation bug in copy_tag.sh.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0112vpMFQJc7Nz7FwE71r5do
This commit is contained in:
parent
58600a5c77
commit
438c39d8e6
19
.github/workflows/pub_dev_push_event.yml
vendored
19
.github/workflows/pub_dev_push_event.yml
vendored
|
|
@ -1,19 +0,0 @@
|
|||
name: Publish Dev Push Event
|
||||
on:
|
||||
workflow_dispatch:
|
||||
push:
|
||||
branches:
|
||||
- dev
|
||||
|
||||
jobs:
|
||||
publish_event:
|
||||
runs-on: ubuntu-latest
|
||||
name: Publish dev push
|
||||
steps:
|
||||
- run: |
|
||||
curl -i \
|
||||
-X POST \
|
||||
-H "Accept: application/vnd.github.v3+json" \
|
||||
-H "Authorization: token ${{ secrets.PUBLISH_PUSH_TOKEN }}" \
|
||||
https://api.github.com/repos/awalsh128/cache-apt-pkgs-action-ci/dispatches \
|
||||
-d '{"event_type":"dev_push"}'
|
||||
19
.github/workflows/pub_master_push_event.yml
vendored
19
.github/workflows/pub_master_push_event.yml
vendored
|
|
@ -1,19 +0,0 @@
|
|||
name: Publish Master Push Event
|
||||
on:
|
||||
workflow_dispatch:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
|
||||
jobs:
|
||||
publish_event:
|
||||
runs-on: ubuntu-latest
|
||||
name: Publish master push
|
||||
steps:
|
||||
- run: |
|
||||
curl -i \
|
||||
-X POST \
|
||||
-H "Accept: application/vnd.github.v3+json" \
|
||||
-H "Authorization: token ${{ secrets.PUBLISH_PUSH_TOKEN }}" \
|
||||
https://api.github.com/repos/awalsh128/cache-apt-pkgs-action-ci/dispatches \
|
||||
-d '{"event_type":"master_push"}'
|
||||
19
.github/workflows/pub_staging_push_event.yml
vendored
19
.github/workflows/pub_staging_push_event.yml
vendored
|
|
@ -1,19 +0,0 @@
|
|||
name: Publish Staging Push Event
|
||||
on:
|
||||
workflow_dispatch:
|
||||
push:
|
||||
branches:
|
||||
- staging
|
||||
|
||||
jobs:
|
||||
publish_event:
|
||||
runs-on: ubuntu-latest
|
||||
name: Publish staging push
|
||||
steps:
|
||||
- run: |
|
||||
curl -i \
|
||||
-X POST \
|
||||
-H "Accept: application/vnd.github.v3+json" \
|
||||
-H "Authorization: token ${{ secrets.PUBLISH_PUSH_TOKEN }}" \
|
||||
https://api.github.com/repos/awalsh128/cache-apt-pkgs-action-ci/dispatches \
|
||||
-d '{"event_type":"staging_push"}'
|
||||
29
.github/workflows/update_release_tags.yml
vendored
Normal file
29
.github/workflows/update_release_tags.yml
vendored
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
name: Update Release Tags
|
||||
on:
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
version:
|
||||
description: "Version tag to update to."
|
||||
type: string
|
||||
required: true
|
||||
|
||||
permissions:
|
||||
contents: write
|
||||
|
||||
jobs:
|
||||
update_release_tags:
|
||||
runs-on: ubuntu-latest
|
||||
name: Run update_release_tags.sh script.
|
||||
steps:
|
||||
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
|
||||
with:
|
||||
fetch-depth: 0
|
||||
- name: Configure git identity
|
||||
run: |
|
||||
git config user.name "github-actions[bot]"
|
||||
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
|
||||
- name: Update tags
|
||||
env:
|
||||
CI: "true"
|
||||
VERSION: ${{ github.event.inputs.version }}
|
||||
run: ./scripts/release/update_release_tags.sh "${VERSION}"
|
||||
|
|
@ -1,8 +1,8 @@
|
|||
# cache-apt-pkgs-action
|
||||
|
||||
[](https://github.com/awalsh128/fluentcpp/blob/master/LICENSE)
|
||||
[](https://github.com/awalsh128/cache-apt-pkgs-action-ci/actions/workflows/master_test.yml)
|
||||
[](https://github.com/awalsh128/cache-apt-pkgs-action-ci/actions/workflows/dev_test.yml)
|
||||
[](https://github.com/awalsh128/cache-apt-pkgs-action/actions/workflows/action-tests.yml?query=branch%3Amaster)
|
||||
[](https://github.com/awalsh128/cache-apt-pkgs-action/actions/workflows/action-tests.yml?query=branch%3Adev)
|
||||
|
||||
This action allows caching of Advanced Package Tool (APT) package dependencies to improve workflow execution time instead of installing the packages on every run.
|
||||
|
||||
|
|
|
|||
28
scripts/release/copy_tag.sh
Executable file
28
scripts/release/copy_tag.sh
Executable file
|
|
@ -0,0 +1,28 @@
|
|||
#!/bin/bash
|
||||
# Point a (moving) tag, e.g. v1 or latest, at the commit of another tag.
|
||||
# Run from anywhere inside a clone of this repository.
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
# shellcheck source=lib.sh
|
||||
source "$(dirname -- "$(realpath -- "${0}")")/lib.sh"
|
||||
usage_msg=$(usage "${0}" "<source tag> <target tag>")
|
||||
|
||||
source_tag="${1:-}"
|
||||
validate_arg "${source_tag}" "Source tag arg must be non-empty." "${usage_msg}"
|
||||
|
||||
target_tag="${2:-}"
|
||||
validate_arg "${target_tag}" "Target tag arg must be non-empty." "${usage_msg}"
|
||||
|
||||
cd "$(git rev-parse --show-toplevel)"
|
||||
git fetch origin --tags --force
|
||||
|
||||
if ! git rev-parse --verify --quiet "refs/tags/${source_tag}" > /dev/null; then
|
||||
echo "error: source tag '${source_tag}' does not exist." >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
confirm_prompt "Do you want to update '${target_tag}' from '${source_tag}'?"
|
||||
|
||||
git tag -fa "${target_tag}" -m "Points ${target_tag} to ${source_tag}." "${source_tag}^{commit}"
|
||||
git push --force origin "refs/tags/${target_tag}"
|
||||
54
scripts/release/lib.sh
Executable file
54
scripts/release/lib.sh
Executable file
|
|
@ -0,0 +1,54 @@
|
|||
#!/bin/bash
|
||||
# Shared helpers for the release scripts in this directory.
|
||||
# Source this file; do not execute it directly.
|
||||
|
||||
#######################################
|
||||
# Yes or no prompt. Auto-confirms when CI=true or ASSUME_YES=1 so the
|
||||
# scripts can also run from a GitHub workflow.
|
||||
# Arguments:
|
||||
# Message to display at prompt.
|
||||
# Returns:
|
||||
# 0 on yes, exits the script on no.
|
||||
#######################################
|
||||
function confirm_prompt {
|
||||
if [[ "${CI:-}" == "true" || "${ASSUME_YES:-}" == "1" ]]; then
|
||||
echo "${1} [auto-confirmed]"
|
||||
return 0
|
||||
fi
|
||||
while true; do
|
||||
read -r -p "${1} [Y|n] " response
|
||||
case ${response} in
|
||||
[Yy]*) return 0 ;;
|
||||
[Nn]*) exit 0 ;;
|
||||
*) echo "Invalid option selected." ;;
|
||||
esac
|
||||
done
|
||||
}
|
||||
|
||||
#######################################
|
||||
# Validate argument and exit if invalid.
|
||||
# Arguments:
|
||||
# Argument to validate.
|
||||
# Message to display on error.
|
||||
# Usage message.
|
||||
# Returns:
|
||||
# None, exits non-zero when the argument is empty.
|
||||
#######################################
|
||||
function validate_arg {
|
||||
if [[ -z "${1:-}" ]]; then
|
||||
printf 'error: %s\n%s\n' "${2}" "${3}" >&2
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
#######################################
|
||||
# Print out command usage.
|
||||
# Arguments:
|
||||
# Name of command.
|
||||
# Parameters.
|
||||
# Returns:
|
||||
# Usage message.
|
||||
#######################################
|
||||
function usage {
|
||||
echo "usage: $(basename "${1}") ${2}"
|
||||
}
|
||||
16
scripts/release/update_release_tags.sh
Executable file
16
scripts/release/update_release_tags.sh
Executable file
|
|
@ -0,0 +1,16 @@
|
|||
#!/bin/bash
|
||||
# Move the floating release tags (v1 and latest) to a released version tag.
|
||||
# Run from anywhere inside a clone of this repository.
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
script_dir="$(dirname -- "$(realpath -- "${0}")")"
|
||||
# shellcheck source=lib.sh
|
||||
source "${script_dir}/lib.sh"
|
||||
usage_msg=$(usage "${0}" "<version tag, e.g. v1.5.3>")
|
||||
|
||||
version="${1:-}"
|
||||
validate_arg "${version}" "Version tag arg must be non-empty." "${usage_msg}"
|
||||
|
||||
"${script_dir}/copy_tag.sh" "${version}" v1
|
||||
"${script_dir}/copy_tag.sh" "${version}" latest
|
||||
Loading…
Reference in a new issue