Skip to content

Merge pull request #153 from tsubasaxZZZ/tsunomur-fix-1221 #60

Merge pull request #153 from tsubasaxZZZ/tsunomur-fix-1221

Merge pull request #153 from tsubasaxZZZ/tsunomur-fix-1221 #60

name: Build Bicep and create Release draft
on:
push:
branches: [main]
paths:
- 'build/**'
pull_request:
branches: [main]
paths:
- 'build/**'
workflow_dispatch:
# on:
# push:
# # branches to consider in the event; optional, defaults to all
# branches:
# - main
# # pull_request event is required only for autolabeler
# pull_request:
# # Only following types are handled by the action, but one can default to all as well
# types: [opened, reopened, synchronize]
# # pull_request_target event is required for autolabeler to support PRs from forks
# pull_request_target:
# types: [opened, reopened, synchronize]
permissions:
contents: read
jobs:
build-and-attach:
runs-on: ubuntu-latest
defaults:
run:
shell: bash
working-directory: build
steps:
- uses: actions/checkout@main
- uses: hashicorp/setup-terraform@v2
- name: Build workbook by Terraform
run: make all
- name: ls
run: ls -lR
- name: Upload workbook files
uses: actions/upload-artifact@v3
with:
name: asset
path: |
build/artifacts/*
if-no-files-found: error
update_release_draft:
permissions:
contents: write # for release-drafter/release-drafter to create a github release
pull-requests: write # for release-drafter/release-drafter to add label to PR
runs-on: ubuntu-latest
if: github.event_name == 'push'
needs: build-and-attach
steps:
# Drafts your next Release notes as Pull Requests are merged into "master"
- uses: release-drafter/release-drafter@v5
id: release_drafter
# (Optional) specify config name to use, relative to .github/. Default: release-drafter.yml
# with:
# config-name: my-config.yml
# disable-autolabeler: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Generate token
id: generate_token
uses: tibdex/github-app-token@v1
with:
app_id: ${{ secrets.FOR_COMMIT_BOT_APP_ID }}
private_key: ${{ secrets.FOR_COMMIT_BOT_PRIVATE_KEY }}
# Checkout code
- uses: actions/checkout@main
with:
token: ${{steps.generate_token.outputs.token}}
- name: Download asset
uses: actions/download-artifact@v3
- name: Display structure of downloaded files
run: ls -lR
- uses: shogo82148/actions-upload-release-asset@v1
with:
upload_url: ${{ steps.release_drafter.outputs.upload_url }}
asset_path: |
asset/*.workbook
overwrite: true
- name: Move files from asset to workbooks directory
run: |
mv -f asset/* workbooks/
- uses: EndBug/add-and-commit@v9.0.1
with:
author_name: github-actions
author_email: '41898282+github-actions[bot]@users.noreply.github.com'
message: Git push workbook files
push: origin main --force --set-upstream
add: |
workbooks/