nightly #473
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 2021 Agnostiq Inc. | |
# | |
# This file is part of Covalent. | |
# | |
# Licensed under the Apache License 2.0 (the "License"). A copy of the | |
# License may be obtained with this software package or at | |
# | |
# https://www.apache.org/licenses/LICENSE-2.0 | |
# | |
# Use of this file is prohibited except in compliance with the License. | |
# Unless required by applicable law or agreed to in writing, software | |
# distributed under the License is distributed on an "AS IS" BASIS, | |
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
# See the License for the specific language governing permissions and | |
# limitations under the License. | |
name: nightly | |
on: | |
schedule: | |
- cron: "*/10 * * * *" | |
permissions: | |
id-token: write | |
contents: read | |
jobs: | |
license: | |
name: License Scanner | |
uses: AgnostiqHQ/covalent/.github/workflows/license.yml@develop | |
tests: | |
name: Unit and Functional Tests | |
uses: AgnostiqHQ/covalent/.github/workflows/tests.yml@develop | |
secrets: inherit # pragma: allowlist secret | |
changelog: | |
name: Assign Version | |
needs: | |
- license | |
- tests | |
uses: AgnostiqHQ/covalent/.github/workflows/changelog.yml@develop | |
secrets: inherit # pragma: allowlist secret | |
push_to_master: | |
name: Push to Master | |
runs-on: ubuntu-latest | |
needs: changelog | |
outputs: | |
release: ${{ steps.push.outputs.release }} | |
steps: | |
- name: Get latest release | |
id: query-tags | |
uses: octokit/[email protected] | |
with: | |
route: GET /repos/AgnostiqHQ/covalent/tags | |
env: | |
GITHUB_TOKEN: ${{ secrets.COVALENT_OPS_BOT_TOKEN }} | |
- name: Parse latest tag | |
id: get-latest-tag | |
run: | | |
# This assumes that the response from the API is sorted in decreasing order (thus the first element is the latest tag) | |
latest_tag=${{ fromJSON(steps.query-tags.outputs.data)[0].name }} | |
echo "::set-output name=tag::${latest_tag}" | |
- name: Checkout default branch | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
persist-credentials: false | |
- name: Push to master | |
id: push | |
run: | | |
CHANGELOG_VERSION="${{ needs.changelog.outputs.version }}" | |
MASTER_VERSION="$(echo ${{ steps.get-latest-tag.outputs.tag }} | cut -c2- )" | |
VERSION="$(cat ./VERSION)" | |
release=false | |
if [ "$MASTER_VERSION" = "$VERSION" ] ; then | |
echo "$VERSION has been previously released." | |
elif dpkg --compare-versions $VERSION 'gt' '0.177.0' ; then | |
git config user.name "CovalentOpsBot" | |
git config user.email "[email protected]" | |
git remote set-url origin https://${{ secrets.COVALENT_OPS_BOT_TOKEN }}@github.com/AgnostiqHQ/covalent.git | |
git push origin HEAD:master | |
release=true | |
else | |
echo "We cannot release versions less than 0.177.0." | |
fi | |
echo "::set-output name=release::$release" | |
release: | |
name: Create Release | |
needs: push_to_master | |
if: needs.push_to_master.outputs.release == 'true' | |
uses: AgnostiqHQ/covalent/.github/workflows/release.yml@develop | |
with: | |
prerelease: true | |
secrets: inherit # pragma: allowlist secret | |
notify: | |
name: Notify Slack | |
needs: release | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout master | |
uses: actions/checkout@v4 | |
with: | |
ref: "master" | |
- name: Format Slack message | |
run: | | |
VERSION="$(cat ./VERSION)" | |
SLACK_MSG=":rocket: Version $VERSION is now available." | |
echo "SLACK_MSG=$SLACK_MSG" >> $GITHUB_ENV | |
- name: Notify Slack | |
uses: rtCamp/action-slack-notify@v2 | |
env: | |
SLACK_CHANNEL: "covalent-ci" | |
SLACK_USERNAME: "CovalentOpsBot" | |
SLACK_MESSAGE: ${{ env.SLACK_MSG }} | |
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }} | |
executor_base_images: | |
name: Build Executor base images | |
runs-on: ubuntu-latest | |
needs: release | |
strategy: | |
matrix: | |
repo: | |
[ | |
"AgnostiqHQ/covalent-aws-plugins", | |
"AgnostiqHQ/covalent-awslambda-plugin", | |
"AgnostiqHQ/covalent-braket-plugin", | |
] | |
steps: | |
- name: Build executor_base_images | |
uses: peter-evans/repository-dispatch@v2 | |
with: | |
token: ${{ secrets.COVALENT_OPS_BOT_TOKEN }} | |
repo: ${{ matrix.repo }} | |
event-type: "prerelease" |