|
| 1 | +name: Demo Stickydisk Usage and Deletion |
| 2 | +on: |
| 3 | + workflow_dispatch: |
| 4 | + pull_request: |
| 5 | + push: |
| 6 | + branches: [main] |
| 7 | + |
| 8 | +jobs: |
| 9 | + demo-stickydisk: |
| 10 | + name: Demo Stickydisk with Deletion |
| 11 | + runs-on: blacksmith-staging |
| 12 | + steps: |
| 13 | + - name: Checkout Repository |
| 14 | + uses: actions/checkout@v4 |
| 15 | + |
| 16 | + - name: Mount Stickydisk |
| 17 | + uses: useblacksmith/stickydisk@v1 |
| 18 | + with: |
| 19 | + key: ${{ github.repository }}-demo-cache |
| 20 | + path: ./demo-cache |
| 21 | + |
| 22 | + - name: Write Data to Stickydisk |
| 23 | + run: | |
| 24 | + echo "Creating demo files in stickydisk..." |
| 25 | + mkdir -p ./demo-cache/data |
| 26 | + echo "Hello from stickydisk!" > ./demo-cache/data/test.txt |
| 27 | + echo "Timestamp: $(date)" >> ./demo-cache/data/test.txt |
| 28 | + echo "Workflow run: ${{ github.run_number }}" >> ./demo-cache/data/test.txt |
| 29 | +
|
| 30 | + # Create some additional files. |
| 31 | + for i in {1..5}; do |
| 32 | + echo "Sample data file $i" > ./demo-cache/data/file$i.txt |
| 33 | + done |
| 34 | +
|
| 35 | + echo "Files created in stickydisk:" |
| 36 | + ls -lah ./demo-cache/data/ |
| 37 | +
|
| 38 | + - name: Read Data from Stickydisk |
| 39 | + run: | |
| 40 | + echo "Reading data from stickydisk..." |
| 41 | + cat ./demo-cache/data/test.txt |
| 42 | + echo "" |
| 43 | + echo "Total files in cache:" |
| 44 | + find ./demo-cache -type f | wc -l |
| 45 | +
|
| 46 | + - name: Delete Stickydisk |
| 47 | + uses: useblacksmith/stickydisk-delete@main |
| 48 | + with: |
| 49 | + delete-key: ${{ github.repository }}-demo-cache |
| 50 | + |
| 51 | + - name: Verify Deletion |
| 52 | + run: | |
| 53 | + echo "Stickydisk with key '${{ github.repository }}-demo-cache' has been deleted." |
| 54 | + echo "This cache will not persist to the next workflow run." |
0 commit comments