15 Commits

Author SHA1 Message Date
James M. Greene
a597aecd27 Merge pull request #19 from kylewlacy/handle-weird-paths
Handle weird input paths
2022-09-02 17:16:39 -05:00
James M. Greene
fa880244ea Remove redundant environment variable 2022-09-02 17:14:45 -05:00
Kyle Lacy
70a14093be Handle weird input paths by passing as env var 2022-08-27 12:42:58 -07:00
James M. Greene
fb03cce750 Merge pull request #18 from actions/major-update-on-published
Run major version updates only on newly published releases
2022-08-19 13:25:51 -05:00
James M. Greene
287627f624 Trigger on "released" to avoid prereleases 2022-08-19 12:31:18 -05:00
James M. Greene
88565766e5 Only update the major tag upon publishing release 2022-08-19 12:29:14 -05:00
Yoann Chaudet
d3a918bb5e Merge pull request #16 from actions/add-tests
Add tests
2022-08-19 08:56:20 -07:00
Yoann Chaudet
8ad82273b5 Update script/new-artifact.sh
Co-authored-by: James M. Greene <JamesMGreene@github.com>
2022-08-19 08:55:21 -07:00
Yoann Chaudet
2f3239288b Update .github/workflows/test-hosted-runners.yml
Co-authored-by: James M. Greene <JamesMGreene@github.com>
2022-08-19 08:55:15 -07:00
Yoann Chaudet
fc6db751bf doc 2022-08-18 17:43:49 -07:00
Yoann Chaudet
888798aeba Add symlink check 2022-08-18 16:49:51 -07:00
Yoann Chaudet
2ab5cde5b2 Normalize 2022-08-18 16:42:34 -07:00
Yoann Chaudet
ae9ee82aa6 Add extract 2022-08-18 16:41:23 -07:00
Yoann Chaudet
78f064a158 Fix path 2022-08-18 16:36:57 -07:00
Yoann Chaudet
6b3212610f Add tests 2022-08-18 16:33:31 -07:00
4 changed files with 75 additions and 7 deletions

View File

@@ -1,7 +1,7 @@
name: Release
on:
release:
types: [edited]
types: [released]
workflow_dispatch:
inputs:
TAG_NAME:

View File

@@ -0,0 +1,52 @@
name: Run Tests
#
# Create some files with script/new-artifact.sh and confirm they are properly packaged and uploaded
# as artifacts with the actions.
#
# This is tested on all OS platforms where we have hosted runners.
#
on:
push:
branches:
- main
pull_request:
jobs:
test:
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Generate files
run: mkdir artifact && mkdir artifact2 && cd artifact && ../script/new-artifact.sh
shell: bash
- name: Upload Pages artifact
uses: ./
with:
path: artifact
- name: Download artifact
uses: actions/download-artifact@v3
with:
name: github-pages
path: artifact2
- name: Extract artifact
run: tar -xf artifact2/artifact.tar -C artifact2 && rm artifact2/artifact.tar
shell: bash
- name: Compare files
run: diff -qr artifact artifact2
shell: bash
- name: Check for absence of symlinks
run: if [ $(find artifact2 -type l | wc -l) != 0 ]; then echo "Symlinks found"; exit 1; fi
shell: bash

View File

@@ -19,11 +19,13 @@ runs:
run: |
tar \
--dereference --hard-dereference \
--directory ${{ inputs.path }} \
-cvf ${{ runner.temp }}/artifact.tar \
--directory "$INPUT_PATH" \
-cvf "$RUNNER_TEMP/artifact.tar" \
--exclude=.git \
--exclude=.github \
.
env:
INPUT_PATH: ${{ inputs.path }}
# Switch to gtar (GNU tar instead of bsdtar which is the default in the MacOS runners so we can use --hard-dereference)
- name: Archive artifact
@@ -32,11 +34,13 @@ runs:
run: |
gtar \
--dereference --hard-dereference \
--directory ${{ inputs.path }} \
-cvf ${{ runner.temp }}/artifact.tar \
--directory "$INPUT_PATH" \
-cvf "$RUNNER_TEMP/artifact.tar" \
--exclude=.git \
--exclude=.github \
.
env:
INPUT_PATH: ${{ inputs.path }}
# Massage the paths for Windows only
- name: Archive artifact
@@ -45,12 +49,14 @@ runs:
run: |
tar \
--dereference --hard-dereference \
--directory "${{ inputs.path }}" \
-cvf "${{ runner.temp }}\artifact.tar" \
--directory "$INPUT_PATH" \
-cvf "$RUNNER_TEMP\artifact.tar" \
--exclude=.git \
--exclude=.github \
--force-local \
"."
env:
INPUT_PATH: ${{ inputs.path }}
- name: Upload artifact
uses: actions/upload-artifact@main

10
script/new-artifact.sh Executable file
View File

@@ -0,0 +1,10 @@
#!/usr/bin/env sh
# Create some files and directories in the current folder
echo 'hello' > hello.txt
mkdir subdir
echo 'world' > subdir/world.txt
# Add some symlinks (which we should dereference properly when archiving)
ln -s subdir subdir-link
ln -s hello.txt bonjour.txt