Condition Syntax Berdasarkan OS Yang Dijalankan Saat Ini
if: matrix.os == 'ubuntu-latest'
if: matrix.os == 'windows-latest'
if: matrix.os == 'macOS-latest'
Condition Syntax Berdasarkan Konteks OS Yang Dijalankan Saat Ini
if: runner.os == 'Linux'
if: runner.os == 'Windows'
if: runner.os == 'macOS'
Contoh Kondisi Job Menggunakan variable RUNNER_OS
- name: Install
run: |
if [ "$RUNNER_OS" == "Linux" ]; then
apt install important_linux_software
elif [ "$RUNNER_OS" == "Windows" ]; then
choco install important_windows_software
else
echo "$RUNNER_OS not supported"
exit 1
fi
shell: bash
Source
Contoh Lengkap GitHub Workflow Job Berdasarkan OS
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macOS-latest]
steps:
- name: Setup Ubuntu
run : echo "iam running on LINUX"
if: runner.os == 'Linux'
Di buat at 2022-11-09 09:42:24
Di update at 2023-09-02 21:28:02
Copyright Notice: All articles in this blog are licensed under CC BY-NC-SA 4.0 unless stating additionally.