2
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

GitHub Actions artifact における symlink

Posted at

actions/upload-artifact@v2 でディレクトリを指定してアップロードすると、その中に含まれる symlink は実際のファイルに置き換えられる。これはたぶん zip の挙動

symlink を保った状態で artifact を維持したい場合は、自前で zip --symlinks で作成した zip をアップロードして、ダウンロード時に解凍すると良い。

検証用のworkflow

name: artifact check

on:
  push:
    branches:
      - main
  workflow_dispatch:

jobs:
  test:
    runs-on: ubuntu-latest

    steps:          
      - name: setup
        run: |
          touch base.txt
          echo "base" >> base.txt
          ln -s  base.txt ./linked.txt
          tree
      - name: check1
        run: |
          tree
      - name: Upload current directory as artifact
        uses: actions/upload-artifact@v2
        with:
          name: test1
          path: .

      - name: Create zip with symlink
        run: zip --symlinks -r myzip.zip ./*

      - name: Upload zip as artifact
        uses: actions/upload-artifact@v2
        with:
          name: test2
          path: myzip.zip
          
      - name: Create download directory
        run: |
          mkdir -p ./download/1
          mkdir -p ./download/2
      - name: Download artifact1
        uses: actions/download-artifact@v2
        with:
          name: test1
          path: ./download/1

      - name: Download artifact2
        uses: actions/download-artifact@v2
        with:
          name: test2
          path: ./download/2

      - name: Check download 1
        run: |
          tree download/1
          
      - name: Unzip
        run: |
          cd ./download/2
          unzip myzip.zip
          rm myzip.zip
          cd ../../
          
      - name: Check download 2
        run: |
          tree download/2

結果

image.png

2
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?