├── LICENSE ├── README.md └── action.yml /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2023 The Meta-DAO 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Setup Anchor 2 | 3 | An optimized action for installing [Anchor](https://www.anchor-lang.com/). 4 | 5 | If you just need Solana (without Anchor), you should also check out [Setup Solana](https://github.com/metaDAOproject/setup-solana). 6 | 7 | # Usage 8 | 9 | Here's an example workflow: 10 | 11 | ```yaml 12 | name: example-workflow 13 | on: [push] 14 | jobs: 15 | run-anchor-build: 16 | runs-on: ubuntu-20.04 17 | steps: 18 | - uses: actions/checkout@v3 19 | - uses: metadaoproject/setup-anchor@v1.2 20 | - run: anchor build 21 | shell: bash 22 | ``` 23 | 24 | This will use the default versions of Anchor, Node.js, and the Solana CLI tools, which are 0.27.0, 16.15.1, and 1.15.2 respectively. You can also configure these versions like so: 25 | 26 | ```yaml 27 | steps: 28 | - uses: actions/checkout@v3 29 | - uses: metadaoproject/setup-anchor@v3.1 30 | with: 31 | anchor-version: '0.30.1' 32 | solana-cli-version: '1.18.18' # Set it to 2.x.x to use the Anza release 33 | node-version: '20.16.0' 34 | ``` 35 | 36 | # License 37 | 38 | The scripts and documentation in this project are released under the [MIT License](LICENSE). 39 | -------------------------------------------------------------------------------- /action.yml: -------------------------------------------------------------------------------- 1 | name: 'Setup Anchor' 2 | description: 'Install Anchor, Solana CLI tools, and Node.js.' 3 | branding: 4 | icon: anchor 5 | color: blue 6 | inputs: 7 | node-version: 8 | description: 'Version of node.js to use' 9 | required: false 10 | default: '20.11.0' # LTS 11 | solana-cli-version: 12 | description: 'Version of Solana CLI to use' 13 | required: false 14 | default: '1.17.16' 15 | anchor-version: 16 | description: 'Version of Anchor to use' 17 | required: false 18 | default: '0.29.0' # latest 19 | runs: 20 | using: 'composite' 21 | steps: 22 | - uses: actions/setup-node@v4 23 | with: 24 | node-version: ${{ inputs.node-version }} 25 | - name: Cache Solana CLI tools 26 | uses: actions/cache@v4 27 | with: 28 | path: | 29 | ~/.cache/solana/ 30 | ~/.local/share/solana/ 31 | key: solana-cli-${{ runner.os }}-build-${{ inputs.solana-cli-version }} 32 | - name: Install Solana CLI tools 33 | run: | 34 | if [[ "${{ inputs.solana-cli-version }}" == 1* ]]; then 35 | cd $HOME 36 | wget https://github.com/solana-labs/solana/releases/download/v${{ inputs.solana-cli-version }}/solana-release-x86_64-unknown-linux-gnu.tar.bz2 37 | tar jxf solana-release-x86_64-unknown-linux-gnu.tar.bz2 38 | echo "$HOME/solana-release/bin" >> $GITHUB_PATH 39 | else 40 | sh -c "$(curl -sSfL https://release.anza.xyz/v${{ inputs.solana-cli-version }}/install)" 41 | echo "/home/runner/.local/share/solana/install/active_release/bin" >> $GITHUB_PATH 42 | fi 43 | shell: bash 44 | - name: Install Anchor 45 | run: npm i -g @coral-xyz/anchor-cli@${{ inputs.anchor-version }} 46 | shell: bash --------------------------------------------------------------------------------