nightly #425
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 GNU Affero General Public License 3.0 (the "License"). | |
# A copy of the License may be obtained with this software package or at | |
# | |
# https://www.gnu.org/licenses/agpl-3.0.en.html | |
# | |
# Use of this file is prohibited except in compliance with the License. Any | |
# modifications or derivative works of this file must retain this copyright | |
# notice, and modified files must contain a notice indicating that they have | |
# been altered from the originals. | |
# | |
# Covalent is distributed in the hope that it will be useful, but WITHOUT | |
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
# FITNESS FOR A PARTICULAR PURPOSE. See the License for more details. | |
# | |
# Relief from the License may be granted by purchasing a commercial license. | |
name: nightly | |
on: | |
schedule: | |
- cron: "0 * * * *" | |
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@v3 | |
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@v3 | |
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", | |
] | |
permissions: | |
id-token: write | |
contents: read | |
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" |