Build and Test #26
Workflow file for this run
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
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 | |
last_part=$(echo "$file" | sed "s|.*/\([^/]*\)/age-plugin-op$|\1|") | |
# Convert to lowercase for consistency | |
formatted_name=$(echo "$last_part" | 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 }} |