Skip to content

Testing matrix

Testing matrix #69

Workflow file for this run

name: Use Hello Action 1
on:
pull_request:
workflow_dispatch:
jobs:
greet:
runs-on: ubuntu-latest
permissions:
pull-requests: write
actions: write
contents: write
packages: write
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 2
- name: Get version from action1
id: get-metadata
uses: ./.github/actions/eas/action1
- name: Print version from action1
run: |
echo "The version is ${{ steps.get-metadata.outputs.version }}"
- name: Get diff from js
run: |
echo "Diff before"
node git-diff.js
echo "Diff after"
- name: Github script to create tags
uses: actions/github-script@v7
with:
script: |
const refObject = {
owner: context.repo.owner,
repo: context.repo.repo,
sha: context.sha
};
# const something = await github.rest.git.createRef({
# ...refObject,
# ref: `refs/tags/mojtag/2${context.sha}`,
# })
# console.log(`Adding git tag 🎯.`, something);
determine_matrix:
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.set-matrix.outputs.result }}
steps:
- name: Set Matrix
id: set-matrix
uses: actions/github-script@v7
with:
script: |
const variants = [];
variants.push({ platform: 'ios', profile: 'betaautomation' });
variants.push({ platform: 'android', profile: 'production' });
variants.push({ platform: 'android', profile: 'productioniap' });
// Set the final matrix
const matrix = { include: variants };
console.log('Matrix:', matrix);
console.log('Matrix JSON:', JSON.stringify(matrix));
return matrix;
log_matrix:
needs: determine_matrix
name: Log Matrix
runs-on: ubuntu-latest
permissions:
pull-requests: write
actions: write
contents: read
packages: write
steps:
- name: Print matrix
run: |
echo "Matrix not toJson: ${{ needs.determine_matrix.outputs.matrix }}"
echo "Matrix from json: ${{ fromJson(needs.determine_matrix.outputs.matrix) }}"
- name: jq 1
run: |
echo "${{ needs.determine_matrix.outputs.matrix }}" | jq -c '.'
- name: jq 2
run: |
echo "${{ toJson(needs.determine_matrix.outputs.matrix) }}" | jq -c '.'
build_and_submit:
needs: determine_matrix
name: Build and Submit
runs-on: ubuntu-latest
permissions:
pull-requests: write
actions: write
contents: read
packages: write
strategy:
fail-fast: false
matrix: ${{ fromJson(needs.determine_matrix.outputs.matrix) }}
steps:
- name: Print matrix
run: |
echo "Matrix profile: ${{ matrix.profile }}"
echo "Matrix platform: ${{ matrix.platform }}"
# example_job_second:
# runs-on: ubuntu-latest
# steps:
# - name: Checkout code
# uses: actions/checkout@v3
# with:
# fetch-depth: 2
# - name: Get commit message header
# id: get_commit_message
# run: |
# COMMIT_MESSAGE_HEADER=$(git log --format=%B -n 1 ${{ github.event.pull_request.head.sha }})
# echo "COMMIT_MESSAGE_HEADER=${COMMIT_MESSAGE_HEADER}" >> $GITHUB_ENV
# - name: Use commit message header
# run: |
# echo "The commit message header is: $COMMIT_MESSAGE_HEADER"
# echo "The other method resolves to: ${{ github.event.head_commit.message }}"
# example_job_third:
# runs-on: ubuntu-latest
# env:
# COMMIT_MESSAGE_HEADER: Revert "[MOB] (PMO-16142) - Fix delay when revisiting tabs (#25207)"
# steps:
# - name: Checkout code
# uses: actions/checkout@v3
# with:
# fetch-depth: 2
# - name: Get commit message header
# id: get_commit_message
# run: |
# COMMIT_MSG='Revert "[MOB] (PMO-16142) - Fix delay when revisiting tabs (#25207)"'
# echo "RESULT: $COMMIT_MSG"
# # echo "COMMIT_MESSAGE_HEADER=$COMMIT_MSG" >> $GITHUB_ENV
# echo "result=$COMMIT_MSG" >> "$GITHUB_OUTPUT"
# # - name: Use commit message header1
# # run: |
# # echo "step 1 start"
# # echo "RESULT: ${{ steps.get_commit_message.outputs.result }}"
# # echo "Finish 1"
# - name: Use commit message header2
# run: |
# echo "step 2 start"
# echo "The commit message header is: $COMMIT_MESSAGE_HEADER"
# echo "Finish 2"
# - name: Use commit message header3
# run: |
# echo "step 3 start"
# echo "The commit message header is: ${{ env.COMMIT_MESSAGE_HEADER }}"
# echo "Finish 3"
# example_job_4:
# runs-on: ubuntu-latest
# steps:
# - name: Checkout code
# uses: actions/checkout@v3
# with:
# fetch-depth: 2
# - name: 🏗 Setup EAS
# uses: expo/expo-github-action@v8
# with:
# eas-version: latest
# token: ${{ secrets.EXPO_TOKEN }}
# - name: Set commit message
# run: |
# COMMIT_MSG='Revert "[MOB] (PMO-16142) - Fix delay when revisiting tabs (#25207)"'
# {
# echo "COMMIT_MESSAGE_HEADER<<EOF"
# echo "$COMMIT_MSG" | sed 's/"/\\"/g'
# echo "EOF"
# } >> $GITHUB_ENV
# - name: Use commit message header 2
# run: |
# echo "step 2 start"
# echo "The commit message header is: $COMMIT_MESSAGE_HEADER"
# echo "Finish 2"
# # SAFE_MESSAGE=$(echo "${{ env.COMMIT_MESSAGE_HEADER }}" | sed 's/"/\\"/g')
# # echo "SAFE_MESSAGE=$SAFE_MESSAGE" >> "$GITHUB_ENV"
# - name: Install dependencies
# run: yarn install
# - name: Create preview
# uses: expo/expo-github-action/preview@v8
# with:
# working-directory: packages/AppOne
# command: eas update --platform android --channel development --message "${{ env.COMMIT_MESSAGE_HEADER }}"
# env:
# NODE_OPTIONS: --max-old-space-size=4096