0 start #16740
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This is a basic workflow to help you get started with Actions | |
name: 0 start | |
concurrency: | |
group: ${{ github.ref }} | |
cancel-in-progress: true | |
on: | |
schedule: | |
- cron: '*/23 */7 * * *' | |
push: | |
branches: [ main ] | |
#pull_request: | |
# branches: [ main ] | |
# Allows you to run this workflow manually from the Actions tab | |
workflow_dispatch: | |
inputs: | |
logLevel: | |
description: 'Log level' | |
required: false | |
default: 'warning' | |
type: choice | |
options: | |
- info | |
- warning | |
- debug | |
print_tags: | |
description: 'True to print to STDOUT' | |
required: false | |
type: boolean | |
username: | |
description: '実行者' | |
default: '-' | |
required: false | |
type: string | |
tags: | |
description: 'Test scenario tags' | |
required: false | |
type: string | |
environment: | |
description: 'Environment to run tests against' | |
type: environment | |
required: false | |
node-version: | |
description: 'node-version' | |
required: true | |
default: '16' | |
type: choice | |
options: | |
- "12" | |
- "14" | |
- "16" | |
outputs: | |
random-number: | |
description: "Random number" | |
value: 3 | |
env: | |
current_date: "123456789" | |
jobs: | |
maketime: | |
name: maketime | |
timeout-minutes: 15 | |
runs-on: ubuntu-latest | |
outputs: | |
output1: ${{ steps.step1.outputs.test }} | |
output2: ${{ steps.step2.outputs.current_datetime }} | |
output3: ${{ steps.step3.outputs.step3_output}} | |
steps: | |
- id: step1 | |
run: | | |
echo ${CURRENT_DATETIME} ${current_date} | |
echo "(1) ths is env=$ENV_1" | |
echo "ENV_1=ENV_3" >> $GITHUB_ENV | |
echo "::set-output name=test::${current_date}" | |
- id: step2 | |
name: Set current datetime as env variable | |
run: | | |
echo "(2) ths is env=$ENV_1" | |
echo "CURRENT_DATETIME=$(date +'%Y%m%d%H%M%S')" >> $GITHUB_ENV | |
echo "::set-output name=current_datetime::$(date +'%Y%m%d%H%M%S')" | |
- id: step3 | |
name: show time 2 | |
run: | | |
echo "(2) ths is env=$ENV_1" | |
echo ${CURRENT_DATETIME} ${current_date} | |
echo "::set-output name=step3_output::'step3_output'" | |
release: | |
needs: maketime | |
runs-on: ubuntu-latest | |
steps: | |
- name: show time on release step | |
run: | | |
echo "maketimeで作った時間n1: ${{needs.maketime.outputs.output1}}" | |
echo "maketimeで作った時間n2: ${{needs.maketime.outputs.output2}}" | |
echo "maketimeで作った時間n3: ${{needs.maketime.outputs.output3}}" | |
echo ${current_date} | |
echo "(2) ths is env=$ENV_1" | |
- name: show github env | |
run: echo ${{github.env}} | |
- id: random-number-generator | |
run: echo "::set-output name=random-id::$(echo $RANDOM)" | |
shell: bash | |
- id: run-at-main-branche | |
if: github.ref == 'refs/heads/main' | |
run: echo "::set-output name=random-id::$(echo $RANDOM)" | |
shell: bash | |
- uses: actions/checkout@v3 | |
with: | |
node-version: ${{ matrix.node }} | |
persist-credentials: true | |
ref: ${{ github.head_ref }} | |
fetch-depth: 0 | |
- run: | | |
set -x | |
assets=() | |
for asset in ./*.md; do | |
assets+=("-a" "$asset") | |
done | |
echo "maketimeで作った時間1: ${{needs.maketime.outputs.output1}}" | |
echo "maketimeで作った時間2: ${{needs.maketime.outputs.output2}}" | |
echo ${{needs.maketime.outputs.output2}} | |
echo "maketimeで作った時間3: ${{needs.maketime.outputs.output3}}" | |
echo ${{needs.maketime.outputs.output1}} | |
tag_name="${{ steps.step1.outputs.test }}${GITHUB_REF##*/}" | |
tag_name2="${{needs.maketime.outputs.output2}}${GITHUB_REF##*/}" | |
hub release create "${assets[@]}" -pm "$tag_name" "$tag_name2" | |
echo "::group::My title" | |
echo "::workflow-command parameter1={data},parameter2={data}::{command value}" | |
echo "::endgroup::" | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
# blankに内包した | |
# call-workflow-gh-command: | |
# needs: maketime | |
# uses: ./.github/workflows/4 ghcommand.yml | |
# with: | |
# datetime: ${{needs.maketime.outputs.output2}} | |
call1-passing-data: | |
needs: [ release ] | |
uses: ./.github/workflows/1print-tag.yml | |
call2-create-branch: | |
needs: maketime | |
uses: ./.github/workflows/2create_branch.yml | |
with: | |
datetime: ${{needs.maketime.outputs.output2}} | |
token: ${{ github.event.secrets.token }} | |
call3-commit-data: | |
needs: maketime | |
uses: ./.github/workflows/3 add_commit.yml | |
with: | |
datetime: ${{needs.maketime.outputs.output2}} |