mirror of
https://forgejo.merr.is/annika/actions-docker-extract.git
synced 2025-12-13 15:31:04 -05:00
ci: Package action automatically on release branch (#15)
This commit is contained in:
parent
abde1147dd
commit
917745b929
9 changed files with 161 additions and 1623 deletions
19
.github/workflows/build_action.yaml
vendored
Normal file
19
.github/workflows/build_action.yaml
vendored
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
name: "Build Action (if not available)"
|
||||
|
||||
on: [workflow_call]
|
||||
|
||||
jobs:
|
||||
build-action:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- run: npm install
|
||||
- name: Build action (if not already built)
|
||||
if: "!startsWith(github.ref, 'refs/heads/release')"
|
||||
run: npm run build
|
||||
- name: Push build into cache
|
||||
if: "!startsWith(github.ref, 'refs/heads/release')"
|
||||
uses: actions/cache@v3
|
||||
with:
|
||||
path: dist
|
||||
key: build-${{ github.sha }}
|
||||
23
.github/workflows/directory.yml
vendored
23
.github/workflows/directory.yml
vendored
|
|
@ -3,11 +3,20 @@ name: Test Directory Extraction
|
|||
on: [push]
|
||||
|
||||
jobs:
|
||||
action:
|
||||
uses: ./.github/workflows/build_action.yaml
|
||||
root-directory:
|
||||
runs-on: ubuntu-latest
|
||||
needs:
|
||||
- action
|
||||
name: Extract Contents of Directory from Example Image
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Load action build from cache
|
||||
uses: actions/cache@v3
|
||||
with:
|
||||
path: dist
|
||||
key: build-${{ github.sha }}
|
||||
- run: docker build -t example:${{ github.sha }} ./.github/tests
|
||||
- uses: ./
|
||||
id: extract
|
||||
|
|
@ -22,9 +31,16 @@ jobs:
|
|||
- run: test -e ${{ steps.extract.outputs.destination }}/y/006.txt || exit 1
|
||||
nested-directory:
|
||||
runs-on: ubuntu-latest
|
||||
needs:
|
||||
- action
|
||||
name: Extract Nested Directory from Example Image
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Load action build from cache
|
||||
uses: actions/cache@v3
|
||||
with:
|
||||
path: dist
|
||||
key: build-${{ github.sha }}
|
||||
- run: docker build -t example:${{ github.sha }} ./.github/tests
|
||||
- uses: ./
|
||||
id: extract
|
||||
|
|
@ -35,9 +51,16 @@ jobs:
|
|||
- run: test -e ${{ steps.extract.outputs.destination }}/x/005.txt || exit 1
|
||||
nested-directory-contents:
|
||||
runs-on: ubuntu-latest
|
||||
needs:
|
||||
- action
|
||||
name: Extract Nested Contents of Directory from Example Image
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Load action build from cache
|
||||
uses: actions/cache@v3
|
||||
with:
|
||||
path: dist
|
||||
key: build-${{ github.sha }}
|
||||
- run: docker build -t example:${{ github.sha }} ./.github/tests
|
||||
- uses: ./
|
||||
id: extract
|
||||
|
|
|
|||
16
.github/workflows/file.yml
vendored
16
.github/workflows/file.yml
vendored
|
|
@ -3,11 +3,20 @@ name: Test File Extraction
|
|||
on: [push]
|
||||
|
||||
jobs:
|
||||
action:
|
||||
uses: ./.github/workflows/build_action.yaml
|
||||
root-file:
|
||||
runs-on: ubuntu-latest
|
||||
needs:
|
||||
- action
|
||||
name: Extract Example File From Root of Built Image
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Load action build from cache
|
||||
uses: actions/cache@v3
|
||||
with:
|
||||
path: dist
|
||||
key: build-${{ github.sha }}
|
||||
- run: docker build -t example:${{ github.sha }} ./.github/tests
|
||||
- uses: ./
|
||||
id: extract
|
||||
|
|
@ -17,9 +26,16 @@ jobs:
|
|||
- run: test -e ${{ steps.extract.outputs.destination }}/001.txt || exit 1
|
||||
nested-file:
|
||||
runs-on: ubuntu-latest
|
||||
needs:
|
||||
- action
|
||||
name: Extract Nexted Example File From Built Image
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Load action build from cache
|
||||
uses: actions/cache@v3
|
||||
with:
|
||||
path: dist
|
||||
key: build-${{ github.sha }}
|
||||
- run: docker build -t example:${{ github.sha }} ./.github/tests
|
||||
- uses: ./
|
||||
id: extract
|
||||
|
|
|
|||
35
.github/workflows/package-action.yaml
vendored
Normal file
35
.github/workflows/package-action.yaml
vendored
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
name: "Package Action"
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- "main"
|
||||
|
||||
env:
|
||||
source: "main"
|
||||
release: "release"
|
||||
|
||||
jobs:
|
||||
package-changes:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
with:
|
||||
ref: "${{ env.release }}"
|
||||
fetch-depth: 0
|
||||
ssh-key: "${{ secrets.COMMIT_KEY }}"
|
||||
- uses: pr-mpt/actions-merge-branch@v2
|
||||
with:
|
||||
from: "origin/${{ env.source }}"
|
||||
commit: false
|
||||
- name: Install Javascript dependencies with npm
|
||||
run: npm install
|
||||
- name: Package action for distribution
|
||||
run: npm run package
|
||||
- name: Push packaged action to branch
|
||||
uses: EndBug/add-and-commit@v7
|
||||
with:
|
||||
add: "['.', 'dist --force']"
|
||||
branch: "${{ env.release }}"
|
||||
default_author: github_actions
|
||||
message: "build: Package action as `dist` with latest changes"
|
||||
16
.github/workflows/platforms.yml
vendored
16
.github/workflows/platforms.yml
vendored
|
|
@ -3,11 +3,20 @@ name: Test Cross Platform Support
|
|||
on: [push]
|
||||
|
||||
jobs:
|
||||
action:
|
||||
uses: ./.github/workflows/build_action.yaml
|
||||
linux:
|
||||
runs-on: ubuntu-latest
|
||||
needs:
|
||||
- action
|
||||
name: Extract Example File on Ubuntu
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Load action build from cache
|
||||
uses: actions/cache@v3
|
||||
with:
|
||||
path: dist
|
||||
key: build-${{ github.sha }}
|
||||
- run: docker build -t example:${{ github.sha }} ./.github/tests
|
||||
- uses: ./
|
||||
id: extract
|
||||
|
|
@ -17,9 +26,16 @@ jobs:
|
|||
- run: test -e ${{ steps.extract.outputs.destination }}/001.txt || exit 1
|
||||
macos:
|
||||
runs-on: macos-latest
|
||||
needs:
|
||||
- action
|
||||
name: Extract Example File on macOS
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Load action build from cache
|
||||
uses: actions/cache@v3
|
||||
with:
|
||||
path: dist
|
||||
key: build-${{ github.sha }}
|
||||
- name: Install Docker
|
||||
env:
|
||||
HOMEBREW_GITHUB_API_TOKEN: "${{ github.token }}"
|
||||
|
|
|
|||
22
.github/workflows/validate-tag.yaml
vendored
Normal file
22
.github/workflows/validate-tag.yaml
vendored
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
name: "Limit Tags To Distributable Commits"
|
||||
|
||||
on:
|
||||
push:
|
||||
tags:
|
||||
- "**"
|
||||
|
||||
jobs:
|
||||
validate-tag:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
with:
|
||||
ssh-key: "${{ secrets.COMMIT_KEY }}"
|
||||
- name: Test that the tagged commit includes `dist`
|
||||
uses: pr-mpt/actions-assert@v2
|
||||
with:
|
||||
assertion: npm://@assertions/directory-exists
|
||||
expected: dist
|
||||
- if: failure()
|
||||
name: Delete invalid tag
|
||||
uses: pr-mpt/actions-delete-tag@v1
|
||||
Loading…
Add table
Add a link
Reference in a new issue