Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't store server name in secrets #491

Open
OmarioHassan opened this issue Jan 4, 2025 · 1 comment
Open

Can't store server name in secrets #491

OmarioHassan opened this issue Jan 4, 2025 · 1 comment

Comments

@OmarioHassan
Copy link

OmarioHassan commented Jan 4, 2025

Bug Description
Storing user name and password in secrets very well but not for server name.

My Action Config

name: 🚀 Deploy website on push

on:
  push:
    branches:
      - main # Replace with your deployment branch if different

jobs:
  build_and_deploy:
    name: 🎉 Deploy
    runs-on: ubuntu-latest

    steps:
      # Checkout the repository
      - name: 🚚 Get latest code
        uses: actions/checkout@v4

      # Set up Node.js environment
      - name: Setup Node.js
        uses: actions/setup-node@v3
        with:
          node-version: 18 # Use the Node.js version compatible with your project

      # Install dependencies and build the React app
      - name: 🔨 Build Project
        run: |
          npm install
          npm run build

      # Deploy built files to SmarterASP.NET using FTP
      - name: 📂 Sync files
        uses: SamKirkland/[email protected]
        with:
          server: something.site4now.net # Replace with your FTP server
          username: "${{ secrets.FTP_USERNAME }}" # Replace with your FTP username
          password: "${{ secrets.FTP_PASSWORD }}" # Replace with your FTP password
          local-dir: dist/ # React production build folder
          server-dir: / # Target directory on the server (adjust as needed)

My Action Log


image

@alexi-courieux
Copy link

alexi-courieux commented Jan 28, 2025

Are you sure your secret is correctly set and that you don't use environment secret ? In which case you must add environment: myEnvironment under runs-on:xxx`

On my side it work with this config :

name: build-and-deploy
on:
  workflow_dispatch:

jobs:
  build:
    runs-on: ubuntu-latest
    environment: production

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

      - name: Set up Node.js
        uses: actions/setup-node@v3
        with:
          node-version: '18'

      - name: Install dependencies
        run: npm install

      - name: Build project
        run: npm run build

      - name: Upload to FTP
        uses: SamKirkland/[email protected]
        with:
          server: ${{ secrets.FTP_SERVER }}
          username: ${{ secrets.FTP_USERNAME }}
          password: ${{ secrets.FTP_PASSWORD }}
          local-dir: dist/
          server-dir: public_html/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants