Skip to content

Merge pull request #712 from lepinkainen/lepinkainen-patch-1 #1086

Merge pull request #712 from lepinkainen/lepinkainen-patch-1

Merge pull request #712 from lepinkainen/lepinkainen-patch-1 #1086

Workflow file for this run

name: test and build
on: [push, pull_request, workflow_dispatch]
jobs:
test-nix:
strategy:
matrix:
runs-on: [ubuntu-latest]
runs-on: ${{ matrix.runs-on }}
steps:
- uses: actions/checkout@v4
# https://github.com/actions/setup-go
- uses: actions/setup-go@v5
# Cache go modules to speed up runs
# https://github.com/actions/cache/blob/main/examples.md#go---modules
- uses: actions/cache@v4
with:
path: |
~/.cache/go-build
~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- name: Extract Branch Name
run: echo "BRANCH=$(echo ${GITHUB_REF##*/})" >> $GITHUB_ENV
- name: Run tests
env:
TEST_SHELL: bash
IMGUR_KEY: ${{ secrets.IMGUR_KEY }}
OMDB_KEY: ${{ secrets.OMDB_KEY }}
YOUTUBE_KEY: ${{ secrets.YOUTUBE_KEY }}
TWITTER_CLIENTID: ${{ secrets.TWITTER_CLIENTID }}
TWITTER_CLIENTSECRET: ${{ secrets.TWITTER_CLIENTSECRET }}
run: make test
- name: Build project
env:
TEST_SHELL: bash
IMGUR_KEY: ${{ secrets.IMGUR_KEY }}
OMDB_KEY: ${{ secrets.OMDB_KEY }}
YOUTUBE_KEY: ${{ secrets.YOUTUBE_KEY }}
TWITTER_CLIENTID: ${{ secrets.TWITTER_CLIENTID }}
TWITTER_CLIENTSECRET: ${{ secrets.TWITTER_CLIENTSECRET }}
run: make build
- uses: actions/upload-artifact@master
with:
name: titleparser.zip
path: build/titleparser
- name: Deploy
# only deploy from master
if: ${{ github.ref == 'refs/heads/master' }}
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_DEFAULT_REGION: ${{ secrets.AWS_DEFAULT_REGION }}
run: |
aws lambda update-function-code --publish --function-name titleparser --zip-file fileb://build/titleparser.zip