Skip to content

Rename artifacts for release #24

Rename artifacts for release

Rename artifacts for release #24

Workflow file for this run

name: Build and Test
on:
release:
types: [ published ]
push:
pull_request:
permissions:
contents: read
jobs:
build:
name: Build
runs-on: ubuntu-latest
strategy:
matrix:
package: [ "age-plugin-op-linux-arm64", "age-plugin-op-linux-arm32", "age-plugin-op-linux-amd64",
"age-plugin-op-darwin-amd64", "age-plugin-op-darwin-arm64" ]
steps:
- name: Checkout Repository
uses: actions/checkout@v4
- name: Install Nix
uses: cachix/install-nix-action@v24
with:
nix_path: nixpkgs=channel:nixos-unstable
- uses: DeterminateSystems/magic-nix-cache-action@main
with:
# Disable diagnostics
diagnostic-endpoint: ""
- name: Build
run: nix build .#${{ matrix.package }} -L
- name: Upload Artifacts
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.package }}
path: result/**/age-plugin-op*
if-no-files-found: error
upload:
name: Upload Release Binaries
if: github.event_name == 'release'
needs: build
permissions:
contents: write
runs-on: ubuntu-latest
steps:
- name: Download Build Artifacts
uses: actions/download-artifact@v4
with:
path: artifacts
merge-multiple: true
- name: Gather Binaries
run: |
source_dir="artifacts"
dest_dir="upload"
mkdir -p $dest_dir
find $source_dir -type f -name "age-plugin-op" | while read -r file; do
# Extract the path without the source directory and filename
path_no_src_file=$(echo "$file" | sed "s|$source_dir/||;s|/age-plugin-op$||")
# Replace slashes with dashes and underscores appropriately
# Also, convert to lowercase for consistency
formatted_name=$(echo "$path_no_src_file" | sed 's|/|_|g' | tr '[:upper:]' '[:lower:]')
new_name="age-plugin-op-${formatted_name}"
mv "$file" "$dest_dir/$new_name"
chmod +x "$dest_dir/$new_name"
echo "Moved and renamed $file to $dest_dir/$new_name"
done
- name: Upload Release Artifacts
run: gh release upload "$GITHUB_REF_NAME" upload/age-plugin-op-*
env:
GH_REPO: ${{ github.repository }}
GH_TOKEN: ${{ github.token }}