Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions .github/workflows/artifacts.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
name: Artifacts

on: [pull_request]

jobs:
artifact-upload:
runs-on: ubuntu-latest
steps:
- run: echo "Demo file" > demo.txt

- name: Upload demo file
uses: actions/upload-artifact@v4
with:
name: demo-artifact
path: demo.txt
18 changes: 18 additions & 0 deletions .github/workflows/concurrency.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: Concurrency

on: [pull_request]

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
exclusive-run:
runs-on: ubuntu-latest
steps:
- name: Slow step
run: |
echo "Starting..."
# Simulate setup time
sleep 120
echo "Finished"
47 changes: 47 additions & 0 deletions .github/workflows/dependent.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: Dependent

on: [pull_request]

jobs:
setup-db:
runs-on: ubuntu-latest
steps:
- name: Setup Database
run: |
echo "Setting up database..."
# Simulate setup time
sleep 5
echo "Database ready."

- name: Initialize DB Schema
run: echo "Initializing DB schema after setup."

lint-code:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Run Linter
run: echo "Running linter on codebase..."

build-and-test:
runs-on: ubuntu-latest
needs: [setup-db, lint-code] # This job waits for both setup-db and lint-code
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Build project
run: echo "Building project..."

- name: Run tests
run: echo "Running tests..."

deploy:
runs-on: ubuntu-latest
needs: build-and-test
environment: production
steps:
- name: Deploy app
run: echo "Deploying app to production..."
16 changes: 16 additions & 0 deletions .github/workflows/env-vars.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: Environment Variables
on: [pull_request]

env:
DAY_OF_WEEK: Monday

jobs:
env-vars:
runs-on: ubuntu-latest
env:
Greeting: Hello
steps:
- name: "Say Hello Mona it's Monday"
run: echo "$Greeting $First_Name. Today is $DAY_OF_WEEK!"
env:
First_Name: Mona
21 changes: 21 additions & 0 deletions .github/workflows/github-token.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: GitHub Token

on: [pull_request]
permissions:
pull-requests: write # Needed to post comments

jobs:
comment-pr:
runs-on: ubuntu-latest

steps:
- name: Comment on PR
uses: actions/github-script@v7
with:
script: |
github.rest.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.payload.pull_request.number,
body: "👋 Hello from `actions/github-script`!"
});
37 changes: 37 additions & 0 deletions .github/workflows/manual.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: Manual

on:
workflow_dispatch:
inputs:
environment:
description: "Target environment"
required: true
default: "staging"
type: choice
options:
- staging
- production
- preview

dry_run:
description: "Run without deploying"
required: false
default: false
type: boolean

custom_message:
description: "Custom deployment message"
required: false
default: "Triggered manually"
type: string

jobs:
manual-run:
runs-on: ubuntu-latest

steps:
- name: Show Inputs
run: |
echo "Deploying to: ${{ github.event.inputs.environment }}"
echo "Dry run: ${{ github.event.inputs.dry_run }}"
echo "Message: ${{ github.event.inputs.custom_message }}"
13 changes: 13 additions & 0 deletions .github/workflows/matrix.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
name: Matrix

on: [pull_request]

jobs:
matrix-example:
runs-on: ubuntu-latest
strategy:
matrix:
version: [1, 2, 3]
language: [node, java]
steps:
- run: echo "Testing language ${{ matrix.language }} version ${{ matrix.version }}"
22 changes: 22 additions & 0 deletions .github/workflows/outputs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: Outputs

on: [pull_request]

jobs:
generate-version:
runs-on: ubuntu-latest
outputs:
version: ${{ steps.set-version.outputs.version }}
steps:
- name: Set version output
id: set-version
run: |
VERSION="v1.2.3"
echo "version=$VERSION" >> $GITHUB_OUTPUT

use-version:
runs-on: ubuntu-latest
needs: generate-version
steps:
- name: Use the version from previous job
run: echo "Deploying version ${{ needs.generate-version.outputs.version }}"
11 changes: 11 additions & 0 deletions .github/workflows/secrets.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
name: Secrets and Variables

on: [pull_request]

jobs:
secrets-variables:
runs-on: ubuntu-latest

steps:
- name: Call api
run: echo "calling ${{ vars.API_URL }} with key ${{ secrets.API_KEY }}"
24 changes: 24 additions & 0 deletions .github/workflows/services.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: Services
on: [pull_request]

jobs:
test-with-db:
runs-on: ubuntu-latest

services:
postgres:
image: postgres:15
env:
POSTGRES_USER: user
POSTGRES_PASSWORD: pass
POSTGRES_DB: testdb
ports:
- 5432:5432
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5

steps:
- run: echo "Would run tests using PostgreSQL service"
11 changes: 11 additions & 0 deletions .github/workflows/testing.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
name: Testing

on: [pull_request]

jobs:
checkout:
runs-on: ubuntu-latest

steps:
- name: Checkout Repository
uses: actions/checkout@v4