Skip to content
This repository has been archived by the owner on Feb 11, 2022. It is now read-only.

Extra environment variables #3

Open
oliversturm opened this issue Jan 15, 2020 · 2 comments
Open

Extra environment variables #3

oliversturm opened this issue Jan 15, 2020 · 2 comments

Comments

@oliversturm
Copy link

I'm trying to deploy Hexo to S3, for which two environment variables are required - in my workflow I have this:

      - name: Deploy
        uses: heowc/action-hexo@master
        env:
          AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
          AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
        with:
          args: deploy

According to the log, the S3 deployer can't find the environment variables, and looking at the docker command line it seems clear to me that these are not passed into the container. Not surprising, I guess... how could this work? Unless I'm missing something, the action doesn't currently support my scenario?

Perhaps it would be possible for the action to accept another parameter, so I could pass the names of my environment variables and then they could be passed on to the docker container?

@oliversturm
Copy link
Author

With a slightly better understanding of how GitHub workflows work, I have just managed to implement a solution - unfortunately it doesn't need your plugin at all! Since I'm doing npm install anyway, it crossed my mind that I could just use run to start the hexo ... commands - no docker required. And this works just fine and doesn't have any more environment variable problems.

I'm not sure how to proceed - to be blunt (no offence intended!), I'm not sure what benefit your action offers. Feel free to close this issue, although I believe it outlines an actual issue that others may encounter. For myself, I'm happy with the solution I found.

For completeness, here's the workflow I use now:

name: Deploy

on: push
jobs:
  build:
    name: Build
    runs-on: ubuntu-latest
    steps:
      - name: Checkout
        uses: actions/checkout@v2
      - name: Setup Node 
        uses: actions/setup-node@v1
        with:
          node-version: '10.x'
      - name: NPM
        run: npm install
      - name: Clean
        run: ./node_modules/.bin/hexo clean
      - name: Generate
        run: ./node_modules/.bin/hexo generate
      - name: Deploy
        run: ./node_modules/.bin/hexo deploy
        env:
          AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
          AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}

@heowc
Copy link
Owner

heowc commented Jan 24, 2020

Good idea!

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

No branches or pull requests

2 participants