DevOps Classroom notes 27/Jul/2026

outputs in github actions:

  • steps output
  • job output

steps.id.name

name: steps-testing

on: 
  push:
    branches: '*'

jobs:
  build-id:
    runs-on: ubuntu-latest
    steps:
      - name: sample data
        id: version_data
        run: |
          echo "version=1.2.3" >> "$GITHUB_OUTPUT"
      - name: print outputs
        run: |
          echo "build version is ${{ steps.version_data.outputs.version}}"

job outputs:

name: steps-testing

on: 
  push:
    branches: '*'

jobs:
  build-id:
    runs-on: ubuntu-latest
    outputs:
      value_id: ${{ steps.version_data.outputs.version }}
    steps:
      - name: sample data
        id: version_data
        run: |
          echo "version=1.2.3" >> "$GITHUB_OUTPUT"
      - name: print outputs
        run: |
          echo "build version is ${{ steps.version_data.outputs.version}}"
  test-data:
    runs-on: ubuntu-slim
    needs: build-id
    steps:
      - name: demo
        run: |
          echo "job version id is ${{ needs.build-id.outputs.value_id }}"

Matrix:

  • Run job with multiple different variable

Basic Matrix:

name: test-Matrix

on: 
  push:
    branches: '*'

jobs:
  test:
    runs-on: ubutnu-latest
    strategy:
      # max-parallel: 2
      matrix:
        node-version: [16, 18, 20]
    steps:
      - name: checkout
        uses: actions/checkout@v7

      - name: install nodejs
        uses: actions/setup-node@v7
        with:
          node-version: ${{ matrix.node-version }}

Multiple Dimenstions:

name: test-Matrix

on: 
  push:
    branches: '*'

jobs:
  test:
    runs-on: ${{ matrix.os }}
    strategy:
      # max-parallel: 2
      matrix:
        os: [ ubuntu-latest, windows-latest]
        node-version: [16, 18]
    steps:
      - name: checkout
        uses: actions/checkout@v7

      - name: install nodejs
        uses: actions/setup-node@v7
        with:
          node-version: ${{ matrix.node-version }}

Inclue & exculde

name: test-Matrix

on: 
  push:
    branches: '*'

jobs:
  test:
    runs-on: ${{ matrix.os }}
    strategy:
      # max-parallel: 2
      matrix:
        os: [ ubuntu-latest, windows-latest]
        node-version: [16, 18]
        exclude:
          - os: windows-latest
            node-version: 18
          - os: ubuntu-latest
            node-version: 16
        include:
          - os: ubuntu-latest
            node-version: 18
          - os: windows-latest
            node-version: 16
    steps:
      - name: checkout
        uses: actions/checkout@v7

      - name: install nodejs
        uses: actions/setup-node@v7
        with:
          node-version: ${{ matrix.node-version }}

Task:

create matrix for docker build and publish

# path: front, backend , api 
- name: Build and push
  uses: docker/build-push-action@v6
  with:
    context: ./${{ matrix.path }}
    file: ./${{ matrix.path }}/Dockerfile
    push: true
    tags: user/${{ matrix.path }}:latest

Leave a comment

Turn on JavaScript to leave a comment.

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Please turn AdBlock off
Social Media Icons Powered by Acurax Web Design Company
Exit mobile version
%%footer%%