Skip to content

Commit

Permalink
ci: update workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
denbite committed Aug 16, 2024
1 parent 3dc3a0b commit 5741f26
Show file tree
Hide file tree
Showing 8 changed files with 113 additions and 136 deletions.
28 changes: 28 additions & 0 deletions .github/workflows/deploy-dev.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Deploy contract on Dev account

on:
push:
branches: [main]

jobs:
deploy-dev:
name: Deploy contract
runs-on: ubuntu-latest
environment: dev.abstract-dao.testnet

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Install cargo-near CLI
run: curl --proto '=https' --tlsv1.2 -LsSf https://github.com/near/cargo-near/releases/download/cargo-near-v0.6.4/cargo-near-installer.sh | sh

- name: Deploy contract to ${{ vars.NEAR_ACCOUNT_ID }}
run: |
cargo near deploy "${{ vars.NEAR_ACCOUNT_ID }}" \
without-init-call \
network-config "${{ vars.NEAR_NETWORK }}" \
sign-with-plaintext-private-key \
--signer-public-key "${{ vars.NEAR_ACCOUNT_PUBLIC_KEY }}" \
--signer-private-key "${{ secrets.NEAR_ACCOUNT_PRIVATE_KEY }}" \
send
27 changes: 0 additions & 27 deletions .github/workflows/deploy-production.yml

This file was deleted.

52 changes: 0 additions & 52 deletions .github/workflows/deploy-staging.yml

This file was deleted.

38 changes: 38 additions & 0 deletions .github/workflows/deploy-tag.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Deploy contract of exact version
run-name: Deploy `${{ inputs.tag }}` version to `${{ inputs.environment }}` by @${{ github.actor }}

on:
workflow_dispatch:
inputs:
environment:
description: "Environment to deploy to"
type: environment
required: true
tag:
description: "The tag version of release (v0.1.0)"
required: true
type: string

jobs:
deploy-tag:
name: Deploy ${{ inputs.tag }} to ${{ inputs.environment }}
environment: ${{ inputs.environment }}
runs-on: ubuntu-latest
steps:
- name: Checkout repository to ${{ inputs.tag }}
uses: actions/checkout@v4
with:
ref: ref/tags/${{ inputs.tag }}

- name: Install cargo-near CLI
run: curl --proto '=https' --tlsv1.2 -LsSf https://github.com/near/cargo-near/releases/download/cargo-near-v0.6.1/cargo-near-installer.sh | sh

- name: Deploy contract to ${{ vars.NEAR_ACCOUNT_ID }}
run: |
cargo near deploy "${{ vars.NEAR_ACCOUNT_ID }}" \
without-init-call \
network-config "${{ vars.NEAR_NETWORK }}" \
sign-with-plaintext-private-key \
--signer-public-key "${{ vars.NEAR_ACCOUNT_PUBLIC_KEY }}" \
--signer-private-key "${{ secrets.NEAR_ACCOUNT_PRIVATE_KEY }}" \
send
22 changes: 22 additions & 0 deletions .github/workflows/pull-request.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: Pull Request Test

on:
pull_request:

jobs:
checks:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Check Formatting
run: cargo fmt --check

- name: Run cargo clippy
run: |
rustup component add clippy
cargo clippy --all-features --workspace --tests -- --warn clippy::all --warn clippy::nursery
- name: Run cargo test
run: cargo test
25 changes: 25 additions & 0 deletions .github/workflows/release-please.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
on:
workflow_dispatch:
pull_request:
types:
- closed

name: Release Please

jobs:
release-please:
runs-on: ubuntu-latest
if: github.event_name == 'workflow_dispatch' || (github.event_name == 'pull_request' && github.event.pull_request.merged == true && contains(github.event.pull_request.body, 'I have created a release *beep* *boop*') && github.event.pull_request.user.login == 'denbite')
steps:
- uses: googleapis/release-please-action@v4
id: release
name: Run release-please command
with:
# this assumes that you have created a personal access token
# (PAT) and configured it as a GitHub action secret named
token: ${{ secrets.REPOSITORY_PERSONAL_ACCESS_TOKEN }}
target-branch: main
config-file: .release-please/config.json
manifest-file: .release-please/.manifest.json
skip-github-release: false
skip-github-pull-request: false
32 changes: 0 additions & 32 deletions .github/workflows/test.yml

This file was deleted.

25 changes: 0 additions & 25 deletions .github/workflows/undeploy-staging.yml

This file was deleted.

0 comments on commit 5741f26

Please sign in to comment.