Skip to content

Commit

Permalink
Preserve executable permissions in archive
Browse files Browse the repository at this point in the history
  • Loading branch information
abailly committed Jan 20, 2025
1 parent 26b1515 commit 94bf99e
Show file tree
Hide file tree
Showing 4 changed files with 72 additions and 2 deletions.
24 changes: 24 additions & 0 deletions .github/actions/download-tar/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# File: .github/actions/download-tar/action.yml
name: Download Tar Artifact
description: >
Download and extract a tar artifact that was previously uploaded in the workflow by the upload-tar
action
inputs:
name:
description: Artifact name
path:
description: Destination path
required: false

runs:
using: composite
steps:
- uses: actions/[email protected]
with:
name: ${{ inputs.name }}
path: ${{ inputs.path }}

- run: ${{ github.action_path }}/untar.sh "${{ inputs.name }}"
working-directory: ${{ inputs.path }}
shell: bash
18 changes: 18 additions & 0 deletions .github/actions/download-tar/untar.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!/usr/bin/env bash
# File: .github/actions/download-tar/untar.sh
set -x
name="$1"

if [[ "$name" == '' ]]; then
dirs=(*/)
else
dirs=(.)
fi

for dir in ${dirs[@]}; do
echo "> Extracting: $dir"
pushd "$dir" >/dev/null
tar xvf artifact.tar
rm artifact.tar
popd >/dev/null
done
28 changes: 28 additions & 0 deletions .github/actions/upload-tar/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# File: .github/actions/upload-tar/action.yml
name: Upload Tar Artifact
description: Compress files with tar prior to artifacting to keep file privileges.

inputs:
name:
description: Artifact name
path:
description: A directory path. The contents of that directory will be tarballed and uploaded.
required: true

runs:
using: composite
steps:

- run: tar cvf artifact.tar *
shell: bash
working-directory: ${{ inputs.path }}

- uses: actions/[email protected]
with:
name: ${{ inputs.name }}
path: ${{ inputs.path }}/artifact.tar
overwrite: true

- run: rm artifact.tar
shell: bash
working-directory: ${{ inputs.path }}
4 changes: 2 additions & 2 deletions .github/workflows/haskell.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,8 @@ jobs:
./build.hs
- name: 🚢 Upload artifact
uses: actions/upload-artifact@v3
uses: ./.github/actions/upload-tar
with:
name: db-server-${{ steps.tag.outputs.value }}-${{ matrix.arch }}-${{ matrix.os }}
path: |
bin/db-server
./bin/

0 comments on commit 94bf99e

Please sign in to comment.