Remove tag before creating a new one #3
Workflow file for this run
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
# Copyright 2023 Pluto TV | |
# Copyright 2022 Google LLC | |
# | |
# Use of this source code is governed by a BSD-style | |
# license that can be found in the LICENSE file or at | |
# https://developers.google.com/open-source/licenses/bsd | |
name: GitHub Nightly Build | |
on: | |
push: | |
branches: [ feature/TRANS-4831-nighty-builds ] | |
workflow_dispatch: | |
jobs: | |
setup: | |
name: Setup | |
runs-on: ubuntu-latest | |
outputs: | |
tag: ${{ steps.compute_tag.outputs.tag }} | |
steps: | |
- name: Checkout development branch | |
uses: actions/checkout@v2 | |
with: | |
ref: 'pluto-cmake' | |
- name: Remove tag | |
uses: actions/github-script@v5 | |
with: | |
script: | | |
github.git.deleteRef({ | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
ref: "tags/nightly" | |
}) | |
- name: Create tag | |
uses: actions/github-script@v5 | |
with: | |
script: | | |
github.rest.git.createRef({ | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
ref: 'refs/tags/nightly', | |
sha: context.sha | |
}) | |
- name: Compute tag | |
id: compute_tag | |
run: | | |
# Strip refs/tags/ from the input to get the tag name, then store | |
# that in output. | |
echo "::set-output name=tag::nightly" | |
draft_release: | |
name: Create GitHub release | |
needs: setup | |
runs-on: ubuntu-latest | |
outputs: | |
release_id: ${{ steps.draft_release.outputs.id }} | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
with: | |
ref: ${{ needs.setup.outputs.tag }} | |
- name: Create dummy release body | |
run: | | |
echo "Nightly build of the latest development branch" > ../RELEASE_NOTES.md | |
- name: Draft release | |
id: draft_release | |
uses: actions/create-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.BUILD_TOKEN_EPHEMERAL}} | |
with: | |
tag_name: ${{ needs.setup.outputs.tag }} | |
release_name: ${{ needs.setup.outputs.tag }} | |
body_path: RELEASE_NOTES.md | |
draft: true | |
lint: | |
needs: setup | |
name: Lint | |
uses: ./.github/workflows/lint.yaml | |
with: | |
ref: ${{ needs.setup.outputs.tag }} | |
build_and_test: | |
needs: [setup, lint, draft_release] | |
name: Build and test | |
uses: ./.github/workflows/build.yaml | |
with: | |
ref: ${{ needs.setup.outputs.tag }} |