diff --git a/.github/workflows/github-actions-demo.yml b/.github/workflows/github-actions-demo.yml new file mode 100644 index 0000000..5dce58b --- /dev/null +++ b/.github/workflows/github-actions-demo.yml @@ -0,0 +1,24 @@ +name: GitHub Actions Demo +on: + push: + paths-ignore: [.github/**] + pull_request: + branches: [ main ] + schedule: + - cron: '15 6 * * 0' + workflow_dispatch: + +jobs: + Build: + runs-on: ubuntu-latest + steps: + - run: | + echo "🎉 The job was triggered by event: ${{ github.event_name }}" + echo "🔎 The name of your branch is ${{ github.ref }} and your repository is ." + + - uses: actions/checkout@v3.3.0 + + - name: List files in the repository + run: | + echo "The repository ${{ github.repository }} contains the following files:" + tree \ No newline at end of file diff --git a/.github/workflows/hello-world-docker-ci.yml b/.github/workflows/hello-world-docker-ci.yml new file mode 100644 index 0000000..85e27bc --- /dev/null +++ b/.github/workflows/hello-world-docker-ci.yml @@ -0,0 +1,21 @@ +name: CI Build for Docker Action +on: + push: + paths: [ hello-world-docker-action/** ] + workflow_dispatch: + +jobs: + test-action: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v3.3.0 + + - name: Run my own container action + id: hello-action + uses: ./hello-world-docker-action + with: + who-to-greet: '@wulfland' + + - name: Output time set in the container + run: echo "The time was ${{ steps.hello-action.outputs.time }} when the action said hello" diff --git a/hello-world-docker-action/Dockerfile b/hello-world-docker-action/Dockerfile new file mode 100644 index 0000000..4ea70f4 --- /dev/null +++ b/hello-world-docker-action/Dockerfile @@ -0,0 +1,7 @@ +FROM alpine:3.10 + +COPY entrypoint.sh /entrypoint.sh + +RUN chmod +x entrypoint.sh + +ENTRYPOINT ["/entrypoint.sh"] \ No newline at end of file diff --git a/hello-world-docker-action/action.yaml b/hello-world-docker-action/action.yaml new file mode 100644 index 0000000..1111ca1 --- /dev/null +++ b/hello-world-docker-action/action.yaml @@ -0,0 +1,15 @@ +name: 'Hello World Docker Action' +description: 'Say hello to a user or the world.' +inputs: + who-to-greet: + description: 'Who to greet' + required: true + default: 'world' +outputs: + time: + description: 'The time we said hello.' +runs: + using: 'docker' + image: 'Dockerfile' + args: + - ${{ inputs.who-to-greet }} \ No newline at end of file diff --git a/hello-world-docker-action/entrypoint.sh b/hello-world-docker-action/entrypoint.sh new file mode 100644 index 0000000..dd072ae --- /dev/null +++ b/hello-world-docker-action/entrypoint.sh @@ -0,0 +1,5 @@ +#!/bin/sh -l + +echo "hello $1" + +echo "time=$(date)" >> $GITHUB_OUTPUT \ No newline at end of file diff --git a/image/advanced.png b/image/advanced.png new file mode 100644 index 0000000..ac4e328 Binary files /dev/null and b/image/advanced.png differ diff --git a/image/composite.png b/image/composite.png new file mode 100644 index 0000000..3e67ea7 Binary files /dev/null and b/image/composite.png differ diff --git a/image/conatiner.png b/image/conatiner.png new file mode 100644 index 0000000..1b66682 Binary files /dev/null and b/image/conatiner.png differ diff --git a/image/containerExample.png b/image/containerExample.png new file mode 100644 index 0000000..1c8ec89 Binary files /dev/null and b/image/containerExample.png differ diff --git a/image/contexts.png b/image/contexts.png new file mode 100644 index 0000000..3f2588a Binary files /dev/null and b/image/contexts.png differ diff --git a/image/image.png b/image/image.png new file mode 100644 index 0000000..3e67ea7 Binary files /dev/null and b/image/image.png differ diff --git a/image/javascript.png b/image/javascript.png new file mode 100644 index 0000000..0f7dcbf Binary files /dev/null and b/image/javascript.png differ diff --git a/image/workflowcommand.png b/image/workflowcommand.png new file mode 100644 index 0000000..70d15e7 Binary files /dev/null and b/image/workflowcommand.png differ diff --git a/notes.md b/notes.md new file mode 100644 index 0000000..e8a12e3 --- /dev/null +++ b/notes.md @@ -0,0 +1,50 @@ +# general notes + +## webhooks +- Trigger + - webhook + - scheduled + - manual + - starter.yml + +## jobs and steps +- Map - run in parallel +- can be chanined using `needs` keyword +- runs on a runner in one process +- contains a sequence of steps +- steps can be a shell command (run) or an action (uses) + +## actions + - reusable step + - Lives in a git repo + - synatx: + ``` + {owner}/{repo}@{ref} + {owner}/{repo}/{path}@{ref} + ./.github/actions/my-action + ``` + - pass vars to action: + - `with:` + - `env:` + +### docker action + - run a docker container as an action + +## contexts and expressions +![alt text](image/contexts.png) + +## workflow commands +![alt text](image/workflowcommand.png) +![alt text](image/advanced.png) + +## actions +### conainter action: +![alt text](image/container.png) +example: +![alt text](image/containerExample.png) + +### javascript +![alt text](image/javascript.png) + +### composite +![alt text](image/composite.png)